Skip to content

NguyenHHKiet/BOOKSTORE-MANAGEMENT-TOPIC

Repository files navigation

Python Flask Tutorial

image

Flask is a very lightweight Python Web Framework, easily helping beginners learn Python to create small websites.

image

Flask-Security allows you to quickly add common security mechanisms to your Flask application. Many of these features are made possible by integrating various Flask extensions and libraries. They include:

  • Flask-Login
  • Flask-Mailman
  • Flask-Principal
  • Flask-WTF
  • itsdangerous
  • passlib
  • QRCode
  • webauthn
  • authlib

Installation

Use the package manager pip to install foobar.

pip install flask

Usage

# Create an environment
> python -m venv .venv
> .venv\Scripts\activate

# setup file, setup debug rerender, and flask run or python fileName.py
> set FLASK_APP=run.py
# Debugger is active!
> set FLASK_DEBUG=1
> python -m flask run
# or
> python run.py

# to open the interpreter
python
>>> import flask
>>> exit()

License

  1. Activate virtual env (.venv\Scripts\activate)

  2. Go to your project root directory

  3. Get all the packages along with dependencies in requirements.txt

pip freeze > requirements.txt
  1. You don't have to worry about anything else apart from making sure next person installs the requirements recursively by following command
pip install -r requirements.txt