콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
7 답글
19417 화면

I've a very basic question of why odoo restart is required when making some changes in python files. I've read this https://www.odoo.com/forum/help-1/question/is-there-a-need-to-restart-openerp-server-when-we-update-a-custom-module-52293, and it says restart is mandatory but didn't say why it's mandatory.

On a running server if i can move a module to addons path and install it (without restarting server) why am i not able to modify python file and upgrade the module.

And if python is interpreted why do i need a restart?

Additionally i've even tried deleting the pycache directory to see if that restricts the interpreter from further compiling it, but it didn't help.

And i'm very clear that module upgradation is required if we modify xml files. No more explanation required on the same. :)

Meanwhile i'm trying to explore if i can modify the python files and tell odoo in someway other than restarting it. Thanks in advance for clarifying me.

아바타
취소

To Configure watchdog with Odoo to restart the odoo service automatically, see this: https://www.youtube.com/watch?v=SKwl_pSBy9c

베스트 답변

You will need to install watchdog to have auto reload option working. Watchdog is available on linux. So whenever you save changes to any of the files under watch, the server will be auto restarted.

e.g.  You can see here:

https://www.awesomescreenshot.com/image/3303625/d6a4656e3d85fa5cd797e6efdfe23619

아바타
취소
작성자

Thanks Devendran. Does it work for mac?

베스트 답변

Hi everyone, --dev reload work with enterprise?

아바타
취소
베스트 답변

Python code is compiled, then interpreted.

Python automatically compiles your script to compiled code, a .pyc file, before running it.

When a NEW module is added and seen for the first time, or when the source is more recent than the current compiled file, a .pyc file containing the compiled code will be created in the same directory as the .py file.  This is why a new addon can be copied and installed without a restart.

After compilation, the sources files are not used by the Server.

Use the --dev reload option to automatically restart after changes WHILE DEVELOPING.

https://www.odoo.com/documentation/11.0/reference/cmdline.html

아바타
취소
작성자

Thanks Ray Carnes, but --dev reload option didn't help for me in pycharm. Can you please tell me what i miss? Am using mac by the way.

베스트 답변

You do need to restart Odoo if you are working only with the Python files, and this is not only "Odooish" stuff, it's common to all python application Django, Flask, Pyramid etc.

To always be on the safer side, you can add this flag to your odoo startup command --dev=all, this will enable Odoo to keep watch on any changes made to python file(s), and reload the server by itself, but only works for python files, as for xml you may still need to restart.


아바타
취소
관련 게시물 답글 화면 활동
4
12월 23
33952
1
11월 17
5250
1
6월 25
437
0
5월 25
525
2
4월 25
2595