- Odoo 12 Development Essentials
- Daniel Reis
- 625字
- 2021-07-02 14:18:41
Installing Odoo from source
To keep things organized, we will work in a /odoo-dev directory inside our home directory. Throughout the book, we will assume that the /odoo-dev is the directory where your Odoo server is installed.
Odoo 12 uses Python 3, specifically 3.5 or later. This means that on the command line, we should use python3 and pip3, instead of python and pip.
Starting from version 11, Odoo runs on Python 3.5 or later. Odoo 11 still runs on Python 2.7, but Odoo 12 only runs on Python 3.5+. Odoo 10 and before only run on Python 2.7.
To install Odoo from source, we start by cloning the Odoo source code directly from GitHub:
$ mkdir ~/odoo-dev # Create a directory to work in $ cd ~/odoo-dev # Go into our work directory $ git clone https://github.com/odoo/odoo.git -b 12.0 \
--depth=1 # Get Odoo sources
The ~ symbol is a shortcut for the user's home directory, such as /home/daniel.
If using Windows Subsystem for Linux, the files in the home directory are stored in a difficult to find place, inside the Windows system folder. A way to avoid this issue is to store our work files in the Windows folder of our preference, and then use a symbolic link for it (similar to a shortcut) in the Linux subsystem. For example, mkdir /mnt/c/Users/Public/odoo-dev creates the C:\Users\Public\odoo-dev working directory, and then ln -s /mnt/c/Users/Public/odoo-dev ~/odoo-dev creates the ~/odoo-dev Linux directory, which is actually a link to the Windows directory. Now, you can run all commands on ~/odoo-dev, such as the previous git clone, and the files are all also available in C:\Users\Public\odoo-dev.
The -b 12.0 option in the Git command explicitly downloads the 12.0 branch of Odoo. At the time of writing, this is redundant since it is the default branch; however, this may change. The --depth=1 option tells Git to download only the last revision, instead of the full change history, making the download significantly smaller and faster.
Before we can run Odoo, we need to install the Python dependencies declared in the requirements.txt file:
$ pip3 install -r ~/odoo-dev/odoo/requirements.txt
Many of these dependencies have Debian packages available to install them, such as python3-lxml. A valid alternative is to install them using the apt package manager. This has the advantage of automatically installing the system dependencies when necessary. The list of dependencies used can be found in the ./odoo/debian/control file.
A few additional Python packages, not included in requirements.txt, can be installed to suppress warning messages or enable additional features:
$ pip3 install num2words phonenumbers psycopg2-binary watchdog xlwt
Now, we can start the Odoo server instance by running the following:
$ ~/odoo-dev/odoo/odoo-bin
To stop the server and return to Command Prompt, press Ctrl + C.
The script used to start Odoo is now ./odoo-bin. In previous Odoo versions, it was ./odoo.py.
By default, Odoo instances listen on port 8069, so if we point a browser to http://<server-address>:8069, we will reach these instances.
As developers, we will need to work with several databases, so it's more convenient to create them from the command line, and we will learn how to do this. Now, press Ctrl + C in the terminal to stop the Odoo server and get back to Command Prompt.
- Word排版技術(shù)大全(第2版)
- Linux操作系統(tǒng)與服務(wù)配置
- Word/Excel 2016高效辦公從入門到精通
- 快·易·通:2天學(xué)會Office辦公應(yīng)用(2016版)
- Excel公式、函數(shù)與圖表應(yīng)用大全
- 和秋葉一起學(xué):秒懂Excel(全彩版)
- WPS Office商務(wù)辦公從新手到高手
- Office 2016入門與提高
- 非常Easy:Office高效辦公
- Office 2016從新手到高手
- Excel效率手冊:早做完,不加班 ( 精華版·函數(shù)篇)(升級版)
- Excel 2016高效辦公實(shí)戰(zhàn)應(yīng)用與技巧大全666招
- Excel行政文秘應(yīng)用之道
- Excel高手捷徑 一招鮮 吃遍天
- PPT職場利器:PPT商務(wù)應(yīng)用案例大全