gpt4 book ai didi

python - 使用 systemctl 重新启动和更新 Odoo 服务

转载 作者:太空宇宙 更新时间:2023-11-04 04:46:55 25 4
gpt4 key购买 nike

Odoo服务由systemctl start odoo启动。我正在使用 Centos。当我想更新更改后的 *.py 代码时,我曾经这样做:

1. systemctl stop odoo
Then I update my module and database by useing this:
2. ./odoo.py -c openerp-server.conf -u <my_module_name> -d <database_name>
3. stop service by ctrl + c
4. systemctl start odoo

但更新更改的方式真的很长而且不舒服。

是否有更短的方法以更短的方式完成相同的操作?

最佳答案

Odoo 服务

您可以像这样进行更改:

  1. 停止服务器:systemctl stop odoo
  2. 启动服务器:systemctl start odoo。这里更新了 .py
  3. 如果您还需要更新 xml 或一些翻译,您可以在 Odoo 界面的模块描述表单上按 Update 按钮。

注意:有一些模块可以重新加载特定的 xml View 。如果您对此感兴趣,我可以看看是否找到了。

没有服务的 Odoo

如果您在本地计算机上进行开发,则不需要使用 systemctl。只需使用 odoo.py 直接运行 Odoo,您就可以立即看到更改:

./odoo.py -c openerp-server.conf -u <my_module_name> -d <database_name>

自动重新加载 Python 文件

还有一个选项可以在 python 文件发生变化时重新加载它们。检查这个other answer :

Normally if you change your python code means, you need to restart the server in order to apply the new changes.

--auto-reload parameter is enabled means, you don't need to restart the server. It enables auto-reloading of python files and xml files without having to restart the server. It required pyinotify. It is a Python module for monitoring filesystems changes.

Just add --auto-reload in your configuration file. By default the value will be "false". You don't need to pass any extra arguments. --auto-reload is enough. If everything setup and works properly you will get

openerp.service.server: Watching addons folder /opt/odoo/v8.0/addons
openerp.service.server: AutoReload watcher running in the server log. Don't forget to install pyinotify package.

但在 odoo 10 中只需添加 --dev=reload 参数

--dev=DEV_MODE      Enable developer mode. Param: List of options
separated by comma. Options : all,
[pudb|wdb|ipdb|pdb], reload, qweb, werkzeug, xml

关于python - 使用 systemctl 重新启动和更新 Odoo 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49358904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com