WIN10 linux subsystem (Windows subsystem for linux, referred WSL) odoo development and debugging environment to build

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

  1. Speed: python speed under linux is better than Windows
  2. Performance: Compared virtual machine, WSL shared with the host hardware resources, almost no performance loss
  3. 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.


    10442883-09406ea41969ad23.png
    Pgsql python and run in WSL subsystem

Software Environment

  • WIN10 Professional Edition
  • Pycharm Pro

We recommended to install the latest version

WSL installation

Preparing for Installation

  1. Open the Settings application system, enter Settings> Update and Security> Developer Options , select Developer mode

    10442883-6805b305090cadef.png
    image.png

  2. Open the Control Panel to enable or disable Windows feature set, check for Linux Windows subsystem

    10442883-b9da9b90e9860cd2.png
    image.png

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.

10442883-a4845001daa893da.png
search results

10442883-9c1f7974c4bd1132.png
Ubuntu 18.04 LTS

Start Menu Applications List will be displayed just installed Linux subsystem after installation
10442883-0bd0a0d62694e660.png
image.png

Environment Configuration

For the first time to enter the message shown in the display subsystem


10442883-3d41c419d7fcfe74.png
image.png

Prompt for user information after the system is initialized


10442883-1362b9f2138e7541.png
image.png

Follow the prompts to set up a user name and password to enter the system
10442883-e4675e332b722f7d.png
image.png

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 updateupdate 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

10442883-2f1e74f6c3ad934a.png
image.png

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
10442883-14618dd8c0b80729.png
image.png

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 /mntlook at the directory structure

  1. In any directory WIN10 ready Odoo code such as D: \ develop \ odoo12 \ community

    10442883-897735905a36c00f.png
    image.png

  2. 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


10442883-56f57fcc2c120951.png
image.png

Try to run odoo python3 odoo-bin

10442883-f7bc50ac0bc7ab13.png
image.png

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

10442883-ff8e1c90135f1e13.png
image.png

Open the window Add Python Interpreter
10442883-784cbd4885491c32.png
image.png

Select the left SSH Interpreter
10442883-9d78871a289943ca.png
image.png

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

10442883-cfd377228c03206b.png
image.png

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)


10442883-13a8212153395f78.png
image.png

Click Finish to wait to set the update Once set up is complete


10442883-2ce3f835bf78c32e.png
image.png

Debug configuration

Top right, click Start option under the Edit Configurations to open the boot configuration settings

10442883-d96fe27d6367671b.png
image.png

It is provided and stored in the setting window

  1. Fill in the appropriate boot option name
  2. Select odoo-bin startup file in the Script Path
  3. 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


    10442883-67927b30e786a4ad.png
    image.png

    Click on the icon to run or debug the top right corner of the console prompt, which represents shown in Figure successfully set


    10442883-460a01b1be38fa2a.png
    Successful operation

We're done! ! !

Guess you like

Origin blog.csdn.net/weixin_33851604/article/details/90866964