官术网_书友最值得收藏!

  • Odoo Development Cookbook
  • Holger Brunn Alexandre Fayolle Daniel Reis
  • 376字
  • 2021-07-16 11:00:28

Managing Odoo environments using the start command

We will often want to use custom or community modules with our Odoo instance. Keeping them in a separate directory makes it easier to install upgrades to Odoo or troubleshoot issues from our custom modules. We just have to add that directory to the addons path and they will be available in our instance, just like the core modules are.

It is possible to think about this module directory as an Odoo environment. The Odoo start command makes it easy to organize Odoo instances as directories, each with its own modules.

Getting ready

For this recipe we need to have already installed Odoo. We assume that it will be at ~/odoo-dev/odoo, and that the virtualenv is activated.

This means that the following command should successfully start an Odoo server:

$ ~/odoo-dev/odoo/odoo.py

How to do it...

To create a work environment for your instance, you need to follow these steps:

  1. Change to the directory where Odoo is:
    $ cd ~/odoo-dev
    
  2. Choose a name for the environment and create a directory for it:
    $ mkdir my-odoo
    
  3. Change to that directory and start an Odoo server instance for that environment:
    $ cd my-odoo/
    $ ../odoo/odoo.py start
    

How it works...

The Odoo start command is a shortcut to start a server instance using the current directory. The directory name is automatically used as the database name (for the -d option), and the current directory is automatically added to the addons path (the --addons-path option) as long as it contains an Odoo addon module. In the preceding recipe you won't see the current directory in the addons path because it doesn't contain any modules yet.

There's more

By default the current directory is used, but the --path option allows you to set a specific path to use instead. For example, this would work from any directory:

$ ~/odoo-dev/odoo/odoo.py start --path=~/odoo-dev/my-odoo

The database to use can also be overridden using the usual -d option. In fact, all the other usual odoo.py command-line arguments, except --addons-path, will work. For example, to set the server listening port, use the following command:

$ ../odoo/odoo.py start --xmlrpc-port=8080

As we can see, the Odoo start command can be a convenient way to quickstart Odoo instances with their own module directory.

主站蜘蛛池模板: 长丰县| 北辰区| 镇赉县| 哈密市| 平定县| 曲沃县| 凌海市| 肥乡县| 辛集市| 重庆市| 邯郸县| 彩票| 林芝县| 肥西县| 大关县| 江孜县| 密云县| 陆丰市| 平泉县| 章丘市| 古浪县| 江阴市| 习水县| 铜鼓县| 福泉市| 盘山县| 郧西县| 辛集市| 东港市| 武宁县| 广汉市| 龙岩市| 淅川县| 运城市| 蓬溪县| 荥经县| 银川市| 石林| 称多县| 日土县| 安多县|