Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use WSL to develop odoo

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to use WSL to develop odoo. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Install ODOO in WSL

Install the Windows Subsystem for Linux in the Control Panel\ all Control Panel items\ programs and Features enable or disable the Windows feature.

Install "Debian GNU/Linux" in Microsoft Store

Enter bash in cmd to enter the bash interface. After waiting for a period of time, you are prompted to enter the account password. At this point, close bash, open cmd again, execute the following command, and we change it to the default root user login.

Debian config-default-user root

In this way, you can enter bash in cmd so that root users can log in by default.

View the version of Linux

Cat / etc/issueDebian GNU/Linux 9\ n\ l

Modify domestic sources

# copy the original file, backup cp / etc/apt/sources.list / etc/apt/sources.list.bak#, edit the source list file Comment on the original nano / etc/apt/sources.list# Ali Cloud source deb http://mirrors.aliyun.com/debian/ stretch main non-free contribdeb-src http://mirrors.aliyun.com/debian/ stretch main non-free contribdeb http://mirrors.aliyun.com/debian-security stretch/updates maindeb-src http://mirrors.aliyun.com/debian-security stretch/updates maindeb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contribdeb-src http:// Mirrors.aliyun.com/debian/ stretch-updates main non-free contribdeb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contribdeb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib# updates apt-get update & & apt-get upgrade

Install Postgresql in windows, modify the pg_hba.conf file, and add 0.0.0.0and0

# IPv4 local connections:host all all 127.0.0.1/32 md5host all all 0.0.0.0/0 md5

Install odoo

Apt-get install apt-transport-https ca-certificateswget-O-https://nightly.odoo.com/odoo.key | apt-key add-echo "deb http://nightly.odoo.com/12.0/nightly/deb/. /" > / etc/apt/sources.list.d/odoo.listapt-get update & & apt-get install odoo-y./odoo start# stop Odoocd / etc/init.d./odoo stop# start Odoocd / etc/init.d./odoo start# restart Odoocd / etc/init.d./odoo restart

Install wkhtmltopdf

Curl-o wkhtmltox.tar.xz-SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xzecho '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum-c-tar xvf wkhtmltox.tar.xzcp wkhtmltox/lib/* / usr/local/lib/cp wkhtmltox/bin/* / usr/local/bin/cp-r wkhtmltox/share/man/man1 / usr/local/share/man/sudo ln-s / Usr/local/bin/wkhtmltopdf / usr/binsudo ln-s / usr/local/bin/wkhtmltoimage / usr/bin

Modify the odoo.conf file

[options]; This is the password that allows database operations:; admin_passwd = admindb_host = localhostdb_port = Falsedb_user = odoodb_password = odoobin_path=/usr/bin/wkhtmltopdfaddons_path = / mnt/g/git@osc/odoo/12.0/themes;/mnt/g/git@osc/odoo/12.0/themes is the path of your own development module, which is saved on G disk

Restart odoo

Cd / etc/init.d./odoo restart

Open the browser http://localhost:8069, and you can run it as a demo server.

Configure the WSL development environment for Pycharm

Configure Pycharm to use WSL as the development environment, refer to the documentation

Use Pycharm to sign in the project folder, as shown below:

Copy the odoo-bin and odoo.conf files to the project file root directory and modify odoo.conf

[options]; This is the password that allows database operations:; admin_passwd = admindb_host = localhostdb_port = Falsedb_user = odoodb_password = odooaddons_path = / usr/lib/python3/dist-packages/odoo/addons,/mnt/g/odoo/12.0/eis,/mnt/g/odoo/12.0/rainbow/bin_path=/usr/bin/wkhtmltopdf

Use WSL as the terminal, as shown below:

Modify the Inerpreter of the project, as shown below:

Modify the "Run/Debug Configurations" of Pycharm, as shown below:

At this point, you can use the WSL environment to develop happily under Windows10, and it is convenient to update the basic code of Odoo. Under WSL, run

Apt-get update-y

Postscript: found that there is a performance problem in WSL development, reset WSL, do not install odoo in WSL, do the following:

Update and install python

# Update apt-get update & & apt-get upgrade-y # install Python3 and other apt-get install python3 python3-pip python3-dev-y

Install wkhtmltopdf

Curl-o wkhtmltox.tar.xz-SL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xzecho '3f923f425d345940089e44c1466f6408b9619562 wkhtmltox.tar.xz' | sha1sum-c-tar xvf wkhtmltox.tar.xzcp wkhtmltox/lib/* / usr/local/lib/cp wkhtmltox/bin/* / usr/local/bin/cp-r wkhtmltox/share/man/man1 / usr/local/share/man/sudo ln-s / Usr/local/bin/wkhtmltopdf / usr/binsudo ln-s / usr/local/bin/wkhtmltoimage / usr/bin

The latest code for git clone odoo12.0 in the project folder

Git clone https://github.com/odoo/odoo.git-- depth 1-- branch 12.0-- single-branch src

In WSL, change to the project folder src directory, and install the requirements.txt dependency

Pip install-r requirements.txt-I https://pypi.doubanio.com/simple

The project folder is shown in the following figure

Copy the odoo-bin and odoo.conf files to the project file root directory and modify odoo.conf

[options]; This is the password that allows database operations:; admin_passwd = admindb_host = localhostdb_port = Falsedb_user = odoodb_password = odooaddons_path = eis,rainbow,src/addons,src/odoo/addonsbin_path=/usr/bin/wkhtmltopdf

Modify the "Run/Debug Configurations" of Pycharm, as shown below:

Thank you for reading! This is the end of this article on "how to use WSL to develop odoo". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report