Skip to content

python-sorocaba/flask_tutorial

Repository files navigation

Build Status

Flask Tutorial

This is an educational project to teach Flask to people who already know Python and the basics of how the HTTP protocol works.

Python intro

See this playlist: https://www.youtube.com/playlist?list=PL6f2gQ2RXLosWiXDHM7vOr1MPdfxPAm_t

HTTP intro

See this video: https://www.youtube.com/watch?v=WWkJLTMbL9A

How setup this project?

Create your virtualenv (using python3):

$ python3 -m venv .venv

Install requirements:

$ pip install -r requirements.txt

Configure your local .env file:

$ cp contrib/env-sample .env

Open .env with your favorite editor and configure your paramethers. Run your server with command below:

$ python manage.py runserver

More information? Follow explanatory videos below.

How to execute queries manually?

Inside on your virtualenv:

$ python manage.py shell

Import db and model:

from tvseries.ext import db
from tvseries.core.models import TVSerie

Bind your session with your application:

db.app = app

Quering example:

db.session.query(TVSerie).all()

If operation is "create", "update" or "delete" dont forget to run commit operation to confirm operation:

db.session.commit()

1.0 - Flask and the most basic application of the world!

2.0 - Flask starting our TV series app!

3.0 - "Beautiful" banners, Jinja2 and starting SQLAlchemy world!

4.0 - ORM, creation and query data! (and some Windows problems :-o)

5.0 - Configuration, structure and Hen and Egg problem!

6.0 - Structure and Hen and Egg problem (solved now)!

7.0 - Deploy part 1!

8.0 - Deploy part 2!

9.0 - Automating deployment with Ansible!

10.0 - Automating deployment with Ansible (part 2)!

11.0 - Migrate databases (part 1)!

12.0 - Migrate databases (part 2)!

13.0 - Working with forms!