Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reloader changes sys.path #826

Closed
daryltucker opened this issue Aug 7, 2013 · 1 comment
Closed

Reloader changes sys.path #826

daryltucker opened this issue Aug 7, 2013 · 1 comment

Comments

@daryltucker
Copy link

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())
@untitaker
Copy link
Contributor

Duplicate of pallets/werkzeug#461

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants