You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading my flask module python -m project.modules.flaskhandler.py everything works nicely. Unfortunately, if I enable debug mode and use_reloader, the module is loaded, but when reloader restarts the application, it changes my sys.path.
sys.path's first value changes from '' to 'project/modules/' which prevents absolute imports from other modules in my project.
I was able to work around this problem with the following code at the top of my flaskhandler.py file:
import sys
import os
# Flask reloader hack
sys.path.append(os.getcwd())
The text was updated successfully, but these errors were encountered:
When loading my flask module
python -m project.modules.flaskhandler.py
everything works nicely. Unfortunately, if I enable debug mode and use_reloader, the module is loaded, but when reloader restarts the application, it changes my sys.path.sys.path's first value changes from '' to 'project/modules/' which prevents absolute imports from other modules in my project.
I was able to work around this problem with the following code at the top of my flaskhandler.py file:
The text was updated successfully, but these errors were encountered: