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
Why doesn't flask reload when I change my code? It should automatically reload my app #2127
Comments
Yes it should. Please describe exactly what you do. |
@untitaker It used to be that I was managing how I do runserver via manage.py with flask-script. Now that since I've been wanting to upgrade to newer flask version 0.12... I'm a bit confused on why this is happening... Also I believe there is something holding back flask from actually being able to auto reload when any part of my code base changes... It doesn't automatically reload anymore... Is there something I can do about this in my development environment? Also because of this change... Will this affect how uwsgi is implemented with supervisor? If so could you please point out where are the changes? Thanks! In addition could you please let me know if application factory pattern of designing larger apps still work? Or what sort of modifications were made to this patter? Thanks! |
This would be an actual bug, but you still haven't described which exact steps you take, such that I can reproduce your issue. There's a bunch of unrelated questions you additionally asked which I can't all answer. I have no experience with uwsgi, however I can't imagine that configuration with uwsgi changes. The app factory pattern also still works. You would create a separate module that calls your factory at import time. We're looking at improving this experience. In the future please ask those questions in the IRC channel or on stackoverflow. This is a bugtracker. Let's focus on the bug you reported. |
(if you want to understand the bigger picture, take a look at https://www.youtube.com/watch?v=1ByQhAM5c1I) |
Nothing has changed about the application factory pattern or about how you would run a Flask app with uWSGI. Nothing should have changed about the reloader, either. Please include a minimal, complete, and verifiable example when reporting a bug. |
@rlam3 What version did you upgrade from? Was it 0.10.X or earlier? And by code, do you mean the .py files or the html files? If it's the html (templates), then is this problem the same as #1907 which was fixed in #1910 ? In 0.11 and 0.12 auto-reloading of templates does not seem to work if app.jinja_env object is accessed before app.run() or manager.run(). For me, the problem manifests when I use Flask-Bootstrap: For example, this causes the problem:
If I edit test.html (which is just 1 line of plain text) then my changes do not take affect until server is restarted. If I remove flask_bootstrap then it works as expected. BRGDS/Chris |
Hi, I'm facing the same problem currently. In my case, my template directory and static directory are custom locations that I am pointing to when I initialize my flask app. When I change either the template or the source files, the app fails to reload correctly. Any suggestions how I might fix this? |
I am also seeing this behavior. Up until late 2017 we were on python2.7 and flask 0.10.1 running on centOS linux. Whenever I made a change to one of our application's python modules or jinja2 templates, flask detected it and automatically reloaded... and I could see the results of my change by refreshing the browser page (pointing at a :5000 url) In late 2017 we upgraded to python3.6 and flask 0.12.2 running on the same centOS linux. Now when I change one of the application's python modules or jinja2 templates, flask still seems to detect it but when I refresh the browser page the change isn't there. I must now do a control-C and restart the flask application, and refresh the browser page, to see my change. This adds a lot of potential confusion to the development process. I hope this issue can be isolated and fixed. |
Make sure you are setting |
Hi, in my monitor I'm seeing this, so I think I'm all set in terms of debug
mode:
* Detected change in '/home/scg/mpd/flaskhome/proj.py', reloading
* Debugger is active!
…On Wed, Jan 24, 2018 at 5:00 PM, Timothy Z Searcy ***@***.***> wrote:
Make sure you are setting FLASK_DEBUG=1.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2127 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AUAL_b2u1KBWbcqxPQ5QtsxVGtJW1vh6ks5tN6f9gaJpZM4LXNDm>
.
|
Has anybody found a solution to the server having to be restarted each time when used with Bootstrap as @pertcode mentioned in the comment above ? |
Why doesn't flask reload when I change my code? It should automatically reload my app.... Is flask-script now obsolete in 0.12 flask?
smurfix/flask-script#172
The text was updated successfully, but these errors were encountered: