Flask and templates ◦ write a simple hello world app • Simple Quotes website ◦ design urls • Get into SQLAlchemy - the database stuff ◦ design the quote model ◦ see how SQLAlchemy works, on terminal ◦ get the basic website working
text file, which can generate any text-based format like HTML, XML etc • Jinja2 ◦ templating language for Python ◦ fast, widely used, designer friendly, easy-to-debug and secure ◦ template inheritance support
if form.validate(): author = slugify(form.author.data) q = Quote(text=form.text.data, author=author) db.session.add(q) db.session.commit() ... if method is GET, data can be accessed as in request. args('<name>') Get the data and validate
Get up and running in minutes. • Deploy instantly with git • Never think about servers, instances or VMS! • Scaling is a single command thing How? $ echo "web: python run.py" >> Procfile $ pip freeze > requirements.txt #add psycopg too $ heroku login $ heroku create $ git push heroku master Ready to deployment - Heroku
$ heroku logs # what's happenening? $ heroku ps # what are running $ heroku addons:add heroku-postgresql --app $ heroku addons # list the accessories $ heroku config # see/set the configuration variables $ heroku run bash # shell on the server in your app's env $ heroku releases # revision history of deployments $ heroku rollback # oops, revert back the last release $ heroku restart $ heroku scale web=3 worker+1