I have two web2py applications; modules are defined in the first one, and symlinked from the second one. .
This is the structure (also notice some symlinked models):
applications/app1/
applications/app1/models/0.py
applications/app1/models/0_template.py ---> symlink to app2/models/0_template.py
applications/app1/models/db.py
applications/app1/modules/
applications/app1/modules/globales.py
applications/app2/
applications/app2/models/0.py ---> symlink to app1/models/0.py
applications/app2/models/0_template.py
applications/app2/models/db.py ---> symlink to app1/models/db.py
applications/app2/modules/ ---> symlink to app1/modules/
This two applications are two separated mercurial repositories.
Every once in a while, I make some change to one (or both) application, then I go to the server and I do a hg pull and hg update.
After the hg update, the application shows an intermitent error 500 with this traceback:
Traceback (most recent call last):
File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/gonguinguen/medios/applications/fundapres_panel/models/0_template.py", line 3, in <module>
from globales import Template, VariableConfiguracion, Estilo, Tema
File "/home/gonguinguen/medios/gluon/custom_import.py", line 95, in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
ImportError: No module named fundapres_panel.modules.globales
In order to get it to work again, I have to restart uwsgi process (that's what I'm using, nginx + uwsgi).
Restarting uwsgi process solves the problem, but I don't want to restart uwsgi process every time I do an update.
Notice that the line throwing the error is in models/0_template.py, which is one of the models that is symlinked.
Also, I don't understand why the error is intermitent (but it's there, the error shows up once every two or three calls).
And one last thing: the error appears even if the update doesn't update anything. Even if nothing has changed in the repository, if I do an update, the error appears and I'm forced to restart uwsgi process.
I'm not using track_changes or anything like that.
I'm using the simple form of the mercurial update, just "hg update", no parameters provided.
I know it's possible to import modules in other ways (using __import__ or importlib), but I've tried that and the problem remains. Any suggestion will be appreciated. Thanks!