
Learn how routes define an app's endpoints in Flask and map URLs to functions with app.route. Return html or json responses, including dictionaries, to serve data.
Learn how Flask routes specify HTTP methods, defaulting to GET; use a methods list or decorators like app.get and app.post to enable GET and POST requests.
Learn how to implement route variables in Flask by defining dynamic endpoints with angle brackets, mapping them to function parameters, and supplying defaults for missing input.
Learn to send json data using Postman, configure http requests with post and other methods, and build a Flask endpoint that accepts and returns json via request.get_json.
Learn how to use Flask redirects after form submission, returning a redirect with url_for to route to a function by name and keep endpoints consistent.
Render conditional blocks in templates (home.html) using if, elseif, and else with a passed number. Display messages for greater than 20, ten to 20, or ten or less.
Learn how to loop over data in Flask templates by passing a list of dictionaries and iterating with for item in data, accessing item.key to render multiple values.
Demonstrate including a template within another using include to inject a nav template across pages, creating reusable links and cleaner templates.
Install Flask SQLAlchemy, import SQLAlchemy, and instantiate the db object with your app; configure the SQLAlchemy database URI to use SQLite, the file-based database.
Create a user table with SQLAlchemy by defining a class that inherits from db.Model, and declare id as primary key, a name string, and a date joined datetime.
Create an insert data function to add a new user to a Flask SQLAlchemy table by instantiating the user, setting date joined with datetime now, adding to session, and committing.
Update data in SQLAlchemy by querying the first user, changing the name to Flask user, and committing the session to persist changes, demonstrated via a Flask shell workflow.
Define a one-to-many relationship by adding an order model with a total field that links to a user via a foreign key, exposing related data through db.relationship and back_populates.
Learn to implement a many-to-many relationship in Flask using an association table order_product, with composite primary keys, foreign keys, and SQLAlchemy relationships via secondary and back_populates.
Learn to query a many-to-many relationship in Flask using Flask-SQLAlchemy, fetch orders, and list associated product names for each order.
Explore querying all data from a model using SQLAlchemy, retrieving all users, counting records, and applying filters to narrow results.
Learn to structure a Flask project using the application factory pattern with a create_app function, separating the project from the virtual environment, and wiring routes before exploring blueprints.
Organize a Flask project with a modular structure by separating routes, models, and extensions into dedicated files, importing blueprints, and configuring via environment-driven settings.
Learn how to use blueprints in a Flask app to modularize routes instead of attaching them directly to the app object, via a create_app function and blueprint registration.
Install Flask, Flask SQLAlchemy, and python-dotenv, then move the form to the templates directory and render form.html via a blueprint.
Set up the database and define Flask models for member, language, and topic, including a many-to-many relationship via a member_topic mapping table.
Initialize the Flask database by configuring the db object in create app, set the SQLAlchemy database URI in the dot env file to a SQLite database, and call db.create_all.
Seed language and topic data in flask app by creating languages (python, javascript, php, ruby, c, go) and topics (web apps, mobile apps, APIs), push app context, add all, and commit.
Explore how to verify form data in Flask by creating a route that handles get and post, names inputs, submits to index, and prints form fields and checkbox values.
Query languages and topics from the database, pass them to the template via a context dictionary, and render a dropdown and checkboxes that reflect database values, saving to the database.
Instantiate a member from the submitted form, set email, location, and a parsed date, handle learn new interest as boolean, and save with topics via db session.
Learn how to update or create member records in a Flask app by checking existence, updating email, password (hashed), location, dates, interests, and topics, with redirects.
Learn how to add an API to our registration format and use Postman to send requests and inspect the API's responses.
Organize files by creating a separate api blueprint. Move the views into a views folder and rename the file to main.py, then adjust imports and paths.
Install Flask, Flask-SQLAlchemy, and a Python env, set up templates and static files, and build an app factory with main and auth blueprints for index, login, register, and orders.
Create flask-sqlalchemy models for a dashboard by configuring extensions.py, sqlite database URI, and building customer, product, and order with foreign keys and revenue goals.
Learn to seed a Flask app database by creating three sample products and generating faker-based orders with CLI commands, queries, and random data.
Write and test SQLAlchemy queries in Flask to summarize orders by month, using group by year and month, and compute counts and revenue by joining product data.
Build a revenue per product query by joining the order table and the product table, multiply quantity by price, and group by product ID to summarize revenue by product.
learn to compute revenue this month per product by building a product method, filtering orders from the first of the month with a SQLAlchemy query and scalar result.
Write queries to fetch today's order count and monthly earnings, using a beginning of day filter and static methods for orders and revenue per product.
Wire orders today and earnings data into your Flask dashboard template by importing models, creating context, and iterating monthly and yearly totals for display.
Learn to calculate revenue goals per product by querying products, computing goal percentages from earnings this month versus monthly goals, and rendering progress via a template pie chart.
Learn to render an area chart by extracting the last 12 months of monthly earnings in Flask, passing the data to JavaScript, and rendering it with the area chart function.
Create a revenue per product and total revenue view using a pie chart, mapping product names to labels and calculating percentages for the template data.
Work with bar chart data by preparing last six and last twelve months of monthly orders and earnings, and pass them to the template as JSON while adjusting chart ticks.
Build a flask login flow with email, password, and remember me, posting to auth.login, then verify the user and redirect to the main index.
Implement password hashing with Werkzeug by using generate_password_hash in the user model and a write-only password property; verify passwords with check_password_hash during login and registration.
Update all dot html links to proper url paths, replacing old links with auth dot login, auth dot register, main dot index, and tables dot orders to ensure navigation works.
Display the logged-in user's name by using the current_user object from flask_login, passing it through routes to templates and rendering current_user.name in the user interface.
Unify the pie chart colors by applying a single color and aligning the hover effect. Round the revenue per product data before sending it to JavaScript to display rounded numbers.
Learn to implement form validation in a Flask app by checking email existence, enforcing password matches, and displaying clear error messages in the login and register forms.
Build a basic food tracker app that tracks dates, per-date protein, carbohydrates, and fats, calculates calories, and lets you add foods and dates to update totals.
Explore the starting HTML files for a Flask app: home, daily food log, and add food pages. See how Bootstrap layouts will later be converted into templates for Flask.
Create a database for the Flask app with three tables: log dates, food, and food date, then connect to the database and prepare to enter and retrieve data.
Learn how to wire database helpers into a Flask app by connecting to the db, using sqlite3 row factories to return dictionaries, and ensuring the connection closes after each request.
Learn to add food items to the database using a Flask form, handling get and post requests and passing name, protein, carbohydrates, and fat.
Learn how to capture form data for name, protein, carbohydrates, and fat, compute calories as protein*4 + carbohydrates*4 + fat*9, and insert the new food record into the database.
Query all entry dates from the log_date table, convert integers to date objects, format them as year month day with no dashes, and order by log_date descending.
Move the database call above the if statement to use it in the post block, then insert the selected food and date into the food date table and commit.
Learn to compute daily food totals in Python by looping log results and summing protein, carbohydrates, fats, and calories into a totals dictionary. Minimize database hits.
Enhance the Flask app by making the home links dynamic, passing dates to the day view, and using date results to generate per-date totals for accurate navigation.
Learn to compute sum totals per day by building a group by query on log date, summing protein, carbohydrates, fats, and calories with aliases in Jade for a Flask app.
Update links across templates to correct routes, including home, food, and add food item. Verify navigation by testing from home to food to item details to ensure all links work.
Refactor this lecture demonstrates moving database functions to a separate database.py, importing them, creating a base template to streamline flask templates, and tidying long queries with multi-line formatting.
deploy a flask app on amazon lightsail by provisioning an ubuntu instance, installing engine X, configuring a proxy to unicorn, and creating a python virtual environment with Flask.
Demonstrates deploying a Flask app to Amazon Lightsail server by pushing to GitHub, cloning on the server, updating the database path, and running with gunicorn, with cloud hosting alternatives.
Identify a bug where new dates don't appear due to inner joins; switch to left joins so dates show without matching food, then can be updated with food.
The lecture demonstrates building a question-and-answer app with user, expert, and admin roles in Flask, featuring a home screen of questions and answer workflows.
Discover the eight templates that power the app, including home, registration, log in, and admin views. Install Flask and convert these templates into dynamic Flask pages for questions and answers.
Set up a Flask app with a virtual environment, install Flask, organize templates and static css, and create routes rendering templates like register, login, question, answer, and users.
Set up Flask database helpers by connecting with get_db, importing it in app.py, and tearing down the connection after each request to prevent memory leaks.
Create a simple SQLite database for a Flask app by defining a minimal schema with users and questions tables and key fields like id, name, and question_text.
Learn to build a register route in a Flask app, hash passwords with Werkzeug, insert new users into the database, and set admin flags for the initial admin user.
Implement flask sessions on login by importing session, generating a secret key, storing the user name in session, and adding a logout route that clears the session and redirects home.
Create a gets_current_user function to fetch the user record from session and database, or nothing if no user is logged in, and use it across routes to drive admin/expert links.
Create a test user, register, and log in with a redirect to the index, then promote a user to expert via the admin interface and update the user setup route.
The admin user views a user setup page that fetches all users with a cursor, displays their name and expert status, and uses a promote route to update and redirect.
List unanswered questions for the current expert by querying questions with no answer, joining users to show who asked. Build and view the unanswered page, then enable the expert to answer.
Learn to build an expert answer workflow in Flask by enabling links, retrieving questions from a database, and saving answers through a form.
Learn to build the home route that displays all answered questions by joining the questions and users tables twice to show asker and expert names, with links to each question.
Update the question page by querying for a single question id, fetch one with a question cursor, and pass question text, answer text, asker, and expert names to the template.
Prevent duplicate users by checking for existing names in the register route, return an error 'user already exists', and display it near the form to guide new registrations.
Protect routes in a Flask app by checking the current user and redirecting unauthenticated users to log in, while restricting admin access to the correct user type.
Format long queries for readability by using triple quotes for multiline sections, breaking lines at proper indentation, and reformatting joins and where clauses to ensure errors are avoided.
Create a reusable base template in a Flask app by defining blocks for title, navigation, and body, then extend it across routes to reduce duplication before deployment.
Deploy a flask app to Heroku, configure a proc file, unicorn, git, and requirements.txt, then push for deployment and migrate from sequel Lite to Postgres.
Set a static secret key across all dynos on Heroku to keep sessions consistent, using an environment variable or a pre-generated value instead of runtime random keys.
Create and manage a restful membership API using the /member endpoint with get, post, put, patch, and delete to list, create, update, and delete members, with basic authentication and Postman.
Set up a Flask membership API with five routes for all members, a member by id, add, update, and delete, and test them with Postman before wiring the database.
Add database helpers for the ultimate Flask course, implement teardown to close the database after requests, and verify get_db integration before schema setup and building the secret light database.
Create a new member by posting JSON data (name, email, level) to the members endpoint, insert the record into the database, and return a JSON object confirming creation.
Create a get route that returns all members as a json array with id, name, email, and level.
Fetches a single member by id from the database using a select query and returns the member's id, name, email, and level, demonstrating retrieval consistency with the post route.
Delete a member by executing a delete from members where id equals the target, commit, and return a deletion confirmation while verifying with a get all request.
Implement a protected decorator in Flask to enforce authentication on every route, using wraps, handling args and kwargs, and validating API username and password before permitting access.
Welcome to The Ultimate Flask Course. This course is designed to teach you everything you need to know to get started building your own Python-based web apps using the Flask framework. I will teach you the basics of Flask and show you some examples of how to build apps using only the features of the Flask framework itself. Then I will teach you various useful extensions that you can use to make adding more powerful features to your Flask apps much easier and show you example apps using those extensions.
You'll learn:
How to build Python web apps with Flask
How to use the Jinja template language to create the look of your apps
How to use the SQLite database to start development
How to use other databases with Flask by using Flask-SQLAlchemy
Using Flask to process incoming request data
How to build an API with Flask
Handle user sessions
How to build working apps with six app examples
In this course, we'll cover popular Flask extensions, including:
Flask-SQLAlchemy
Flask-WTF
Flask-Bootstrap
Flask-Mail
Flask-Migrate
Flask-Uploads
Flask-Login
Flask-Admin
Flask-User
Flask-Babel
Flask-Restless
Flask-SocketIO
Flask-Security
What do you need to know before starting the course?
As long as you have some basic experience with Python, you are ready to take the course. It's helpful to know some basics of HTML as well.
I look forward to seeing you in the course and hearing your thoughts.