I hope you remember these steps for looking at the files and code from Grinberg’s “flasky” repo:
- cd into your flasky directory
- activate the virtualenv
- Do a git checkout for the appropriate chapter and section (Grinberg gives you these explicitly throughout each chapter); for example:
git checkout 4a
When you run the hello.py program at first, you type
python hello.py at the $ prompt. This starts the server and the app, as we did in class on March 15. You can view the page at localhost:5000 in your browser.
Starting in chapter 2, when we have
manager = Manager(app) in the program, we have to run the program with an extra command-line command, runserver:
$ python hello.py runserver
There’s one other possible stumbling block to be avoided: Have you “pipped” all the things that Grinberg has told you to install?
Here’s a list in case you forgot something:
- $ pip install flask-script (p. 17)
- $ pip install flask-bootstrap (p. 26)
- $ pip install flask-moment (p. 33)
- $ pip install flask-wtf (p. 37)
- $ pip install flask-sqlalchemy (p. 52)
- $ pip install flask-migrate (p. 64)
You can use the command
pip freeze to see a list of all the packages you have installed.
So if you are getting errors when you try to run something, make sure you have installed all the required packages!