As you may know, uwsgidecorators
are only working if your app is running in the context of uwsgi
, which is not exactly clear from the documentation: https://uwsgi-docs.readthedocs.io/en/latest/PythonDecorators.html
My code is using these decorators, for example for locking:
@uwsgidecorators.lock
def critical_func():
...
And this works just fine when I deploy my app with uwsgi, however, when starting it directly from Python shell, I'm getting an expected error:
File ".../venv/lib/python3.6/site-packages/uwsgidecorators.py", line 10, in <module>
import uwsgi
ModuleNotFoundError: No module named 'uwsgi'
Is there any known solution to run my app in both modes? obviously I don't need the synchronization and other capabilities to work when using simple interpreter, but doing some try-except importing seems like really bad coding.