Foreword
The author is a tool like the pursuit as little as possible to achieve multi-purpose developers, at the beginning odoo time to develop several sets of agonizing over development environment, such as VSCode, Visual Studio, Pycharm etc; ultimately chose this WSL + Pycharm Pro a perfect combination; its advantage lies in its ability while retaining the ease of use with the Linux development friendliness of Windows, while using some of the Windows platform software office while also developing and debugging in the Linux environment, to match or exceed that of systems development experience mac
WSL Description: Windows Subsystem for Linux (WSL for short) is a is on Windows 10 can run native Linux binary executable file (ELF format) compatibility layer. It is a collaboration with Canonical developed by Microsoft, the goal is to make pure Ubuntu 14.04 "Trusty Tahr" images can be downloaded and expanded into a local computer user, and the tools and utilities in the image can natively run in this subsystem.
Solution Advantages
- Speed: python speed under linux is better than Windows
- Performance: Compared virtual machine, WSL shared with the host hardware resources, almost no performance loss
-
Convenient: since the file system After sharing, in the IDE, or Win which modify the good document editor does not need to copy the linux, directly modify the XML file upgrade module, py file modification directly in Pycharm to restart the odoo; save file synchronization operating time, but also eliminates forgotten debug file synchronization inconsistencies caused inconvenience caused.
Software Environment
- WIN10 Professional Edition
- Pycharm Pro
We recommended to install the latest version
WSL installation
Preparing for Installation
-
Open the Settings application system, enter Settings> Update and Security> Developer Options , select Developer mode
-
Open the Control Panel to enable or disable Windows feature set, check for Linux Windows subsystem
installation
WSL WIN10 installer built into the app store , you need to sign in to Microsoft account WIN10 systems;
open app store search key word: bash wsl linux, you can search the app store ready to hit linux subsystem, select the one you like to install.
Start Menu Applications List will be displayed just installed Linux subsystem after installation
Environment Configuration
For the first time to enter the message shown in the display subsystem
Prompt for user information after the system is initialized
Follow the prompts to set up a user name and password to enter the system
Update apt source
After entering the system suggested that the first thing to do is to modify apt to pip source, when such software is installed in the back will save a lot of download time
enter the command sudo vi /etc/apt/source.list
to clear the existing text and paste the following configuration information and save the configuration
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe
Run sudo apt update
update configuration
Note: As used herein, Ali cloud apt source, you can also use other domestic sources
Pip install package management tool and configure the update source
sudo apt install python3-pip
Create a profile
cd ~
mkdir .pip
vi .pip/pip.conf
Writes the following
[global]
index-url = https://pypi.douban.com/simple
trust-host = pypi.doban.com
As used herein, watercress pip source can also be replaced by other domestic sources themselves
SSH port installation and modification
ubuntu18 already comes ssh server, no need to install
but because the developer options open later, WIN10 will install ssh port 22 and occupied, in order to avoid conflicts of ubuntu ssh port will be modified to other ports
sudo vi /etc/ssh/sshd_config
The Port parameter value is changed to 2222
and PasswordAuthentication changed to yes
Then open the Windows console window, enter ssh linux user name @localhost -p2222
prompted to enter a password that is authorized representatives and setting success
Postgresql Database Installation and Configuration
slightly
Other articles in this section refer to odoo installation and deployment, not repeat them here.
Pycharm remote debugging configuration
Mapping odoo directory
Linux and WIN10 subsystem shared file system, WIN10 file can be accessed in the / mnt directory subsystem can
la /mnt
look at the directory structure
-
In any directory WIN10 ready Odoo code such as D: \ develop \ odoo12 \ community
Users enter linux directory to create a soft link
cd ~
ln -s /mnt/d/develop/odoo12/community/ odoo12
At this point in the file can be used directly in the directory odoo directory odoo12
Try to run odoo python3 odoo-bin
Be able to operate after odoo have been able to see up and running in a linux environment, your next installation dependent python library
Installation odoo dependent python library
slightly
This part of the installation documentation can reference other odoo
Configure Remote python environment
Open Pycharm settings: File> Settings> Project: Project name> Project Interpreter
Open the window Add Python Interpreter
Select the left SSH Interpreter
After here can be seen in the latest official version has support Pycharm WSL environment, but turned down a multi-threaded test odoo in this process may be configured to close odoo process to clear dirty situation, we do also use SSH Interpreter
After entering the username and password to the next step until the open window of FIG
selected subsystem to linux Interpreter Python3 installation directory setting /usr/bin/python3.6
On the mapping directory of the remote server Remote Path set under subsystem creates good soft link code directory above as the Running code below
and uncheck Automatically upload project files to the server options (because subsystem and Windows shared file, so do not automatically sync to inux in)
Click Finish to wait to set the update Once set up is complete
Debug configuration
Top right, click Start option under the Edit Configurations to open the boot configuration settings
It is provided and stored in the setting window
- Fill in the appropriate boot option name
- Select odoo-bin startup file in the Script Path
-
Set of Parameters odoo startup parameters in the configuration file path generally -c
4. Select just configured the Python environment in the Python Interpreter options
Click on the icon to run or debug the top right corner of the console prompt, which represents shown in Figure successfully set
We're done! ! !