Mind Flow Productions

Systems & Productivity

ETR: 1 minute

This UnDockerizes Nick’s snakeeyes app from his Flask SASS course

To start create a virtual environment called ‘test’

Copy the contents of a folder from the course to a new folder called _test

pip install -r requirements.txt

If ‘Click’ is part of the requirements then run setup.py via pip: pip install —editable . This installs whatever is in setup.py and allows it to be edited without constantly ‘pip install’ing the new version. (I think that’s what it does…)

Make sure SERVER_NAME is set in the config.settings.py file or tests will fail. For dev set it to ‘localhost:5000’ or whatever port you are using

The app can be run from the app root folder with: python ./snakeeyes/app.py

The command line for testing with cli commands is: snakeeyes flake8 snakeeyes test snakeeyes cov For help on commands available use: snakeeyes

Even though Nick was using python2.7 in docker, I am using python 3.5 If this fails at some point I will check Nick’s compatibility video and code base. I am going through the course gradually so as not to come up against too many errors at one time.

https://www.fullstackpython.com/blog/python-3-flask-green-unicorn-ubuntu-1604-xenial-xerus.html

Flask

Flask requires templates to be in the templates folder which is relative to the application folder (where you run the app). But I think each app in a blueprint can have its own templates folder…

DON’T do this anymore: app.run(debug=True)

DO THIS instead: $ export FLASK_APP=/path/to/file.py $ export FLASK_DEBUG=True $ flask run

** according to the creator of flask: flask-sqlalchemy - yes! flask-restful - not so much! to many opinions which can get in your way. voluptuous - yes!