Installation — Flask Documentation (2.2.x) (2023)

Python Version

We recommend using the latest version of Python. Flask supports Python3.7 and newer.

Dependencies

These distributions will be installed automatically when installing Flask.

  • Werkzeug implements WSGI, the standard Python interface betweenapplications and servers.

  • Jinja is a template language that renders the pages your applicationserves.

  • MarkupSafe comes with Jinja. It escapes untrusted input when renderingtemplates to avoid injection attacks.

    (Video) How to Install Flask on Windows 10 | Complete Installation Guide 2021

  • ItsDangerous securely signs data to ensure its integrity. This is usedto protect Flask’s session cookie.

  • Click is a framework for writing command line applications. It providesthe flask command and allows adding custom management commands.

Optional dependencies

These distributions will not be installed automatically. Flask will detect anduse them if you install them.

greenlet

You may choose to use gevent or eventlet with your application. In thiscase, greenlet>=1.0 is required. When using PyPy, PyPy>=7.3.7 isrequired.

(Video) How to Upload Files with Flask Using Python

These are not minimum supported versions, they only indicate the firstversions that added necessary features. You should use the latestversions of each.

Virtual environments

Use a virtual environment to manage the dependencies for your project, both indevelopment and in production.

What problem does a virtual environment solve? The more Python projects youhave, the more likely it is that you need to work with different versions ofPython libraries, or even Python itself. Newer versions of libraries for oneproject can break compatibility in another project.

Virtual environments are independent groups of Python libraries, one for eachproject. Packages installed for one project will not affect other projects orthe operating system’s packages.

Python comes bundled with the venv module to create virtualenvironments.

Create an environment

Create a project folder and a venv folder within:

$ mkdir myproject$ cd myproject$ python3 -m venv venv
(Video) Setup a Flask Application in VS Code and Run a Basic App

Activate the environment

Before you work on your project, activate the corresponding environment:

$ . venv/bin/activate
(Video) Python Flask Tutorial | Getting Form Submission Data

Your shell prompt will change to show the name of the activatedenvironment.

Install Flask

Within the activated environment, use the following command to installFlask:

$ pip install Flask

Flask is now installed. Check out the Quickstart or go to theDocumentation Overview.

Videos

1. Python Website Full Tutorial - Flask, Authentication, Databases & More
(Tech With Tim)
2. Web Development with Python Tutorial – Flask & Dynamic Database-Driven Web Apps
(freeCodeCamp.org)
3. Flask Tutorial #4 - HTTP Methods (GET/POST) & Retrieving Form Data
(Tech With Tim)
4. ctrlX Apps – Serving data to WebIQ via HTTP
(Bosch Rexroth US)
5. Apache Flask Tutorial - Flaskr Mini Project - Part 1
(Jingyan Wang)
6. Create A REST API using Python Flask and ChatGPT
(Mpcsj Tech Tips)
Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated: 24/05/2023

Views: 6107

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.