/flask-tutorial

Flask Tutorial From Flask's Docs (Flaskr App)

Primary LanguagePython

Flask Tutorial - Flaskr

This is not a real application. It is a tutorial application that demonstrates how you can make a simple flask application.

Source Material: https://flask.palletsprojects.com/en/1.1.x/tutorial/

What is this?

This is the code repo for the excellent Flaskr application. It is capable of doing amazing things.

Why make this?

To change your life!

How do I use it?

  • Register
  • Log in
  • Create your own posts
  • Read others posts

How do I contribute to it?

Get it

  • git clone <repo-addr>

Dev It

  • Needs venv & python3

  • make venv

  • make dev_db

  • make dev

  • <code something>

  • <test your thing>

  • make test

How do I build and distribute it?

Note, desired location should have waitressandvenv` already.

See: https://flask.palletsprojects.com/en/1.1.x/tutorial/deploy/#deploy-to-production

  • make clean dist
  • cp dist/flaskr-X.X.X-py3-none-any.whl </desired/location>
  • pip install flaskr-X.X.X-py3-none-any.whl
  • init db if needed
    • export FLASK_APP=flaskr && flask init-db
  • set up secret if needed
    • echo "SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/'" >> <venv>/var/flaskr-instance/config.py
  • Serve app
    • waitress-serve --port 80 --call 'flaskr:create_app'

Resources

To Dos

Questions and Mysteries

  • __init__, modules, and file paths in general in Python are tough for me to understand at the moment.

What's Next?