Comments (8)
Can you give me more details?
I'm not sure I understand, because when you run the application in debug mode any time the source files change the application restarts on its own, there shouldn't be a need for you to remember to do that.
from flasky.
Ah, I didn't realize that. That does make a difference, as I am running your tutorial in a Vagrant environment and despite my efforts otherwise, I can't seem to get debug mode to work. Having said that, I haven't tried it since the option to specify the host through the command line was introduced. I will get back on my dev machine ASAP and report back in further detail.
from flasky.
Ok, now that I am in front of my machine and your book I see that runserver
starts the web server in debug mode -- I had forgotten that detail.
So my Vagrantfile has this in it:
config.vm.network :forwarded_port, guest: 5000, host: 5000
but from the beginning of the tutorial/book, when I was doing
if __name__ == '__main__':
app.run()
I was not ever able to get the debug=True
argument to app.run()
work. (I believe I got a 500 error in the browser, but I might not be remembering that correctly.) I eventually realized that doing app.run(host='0.0.0.0')
would work, and I didn't try to troubleshoot further as I didn't want to get sidetracked. And it seems that debug
still isn't an option for me, as indicated upthread. I now have
if __name__ == '__main__':
manager.run()
(with Manager properly imported and set), and I am just issuing $ python hello.py runserver --host 0.0.0.0
but I apparently am not able to reap the benefits of being in debug mode.
In short, it seems that me with my Vagrant issue is somewhat of an edge case, and again, as long as I remember to re-load the python script there won't be an issue as far as that goes. If you are willing/able to figure out how to adjust Vagrantfile settings to allow for debug
mode to actually be enabled, that's awesome -- but, I perfectly understand if you have other fish to fry! For myself, I learned just enough Vagrant to get myself an isolated environment for projects like your tutorial, and I will have to revisit later when my immediate objective is accomplished.
from flasky.
Do you get these lines printed in the Vagrant console when you start the server?
* Running on http://0.0.0.0:5000/
* Restarting with reloader
If you do, then open a second console and make a small edit in one of the .py files. That should trigger the app to restart, and the first console should print a message with the file that changed.
This should work, regardless of your use of Vagrant or the networking configuration that you are using.
from flasky.
Actually, I think I just figured the problem out. It looks like the current release of Flask-Script is broken, it always disables debug mode.
Try downgrading to 0.6.6, the version I used back when I developed Flasky and let me know if that addresses the problem.
from flasky.
Miguel, you rock. That did it. I tested both app.run(host='0.0.0.0')
and manager.run()
at first and verified that I was not seeing the second line * Restarting with reloader
. I then issued pip freeze
and verified that the Flask-Script version was 2.0.3, so I then issued sudo pip uninstall flask-script
and sudo pip install flask-script==0.6.6
. At that point, running hello.py
with manager.run()
showed that previously missing line in the console, and after I made a slight edit to hello.py
(and saved it), I saw that it detected the change and reloaded. I think I'm good. Thanks again!
from flasky.
Glad you are up and running. For your reference, this is the Flask-Script bug: smurfix/flask-script#91. The bug was fixed, but in a backwards incompatible way. I hope I can convince the developer to correct the situation.
from flasky.
Indeed; I can certainly understand that it's a pain for this to come up after you've already put the book to bed.
from flasky.
Related Issues (20)
- Mail from must equal authorized user? HOT 2
- The app has no db file to initialize the database HOT 4
- Breaks in python 3.10.6 HOT 6
- Update Read me. HOT 1
- Flask mail returning mail as exception HOT 1
- Selenium testing failing HOT 3
- Question on before_request and unconfirmed routes. HOT 4
- While testing client requests, how get/post by endpoint instead of url? HOT 2
- Used flask_ldap3_login? HOT 2
- no .env and .env-mysql file when I run docker-compose HOT 7
- Hello world
- html inheritance on tag 3b
- Flask-WTF Question HOT 2
- Redirect issue in Example 8-23 HOT 4
- HTML Syntax Issue in 2nd Edition of Book HOT 1
- Example 14-4 Question in 2nd Edition HOT 4
- A 'SQLAlchemy' instance has already been registered on this Flask app. Import and use that instance instead. HOT 1
- CSRF session token is missing
- Flask run command doesn't work HOT 6
- SMTP Handler - No Emails HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flasky.