close

How to setup environment variables for `flask run` on Windows?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to setup environment variables for flask run on Windows in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to setup environment variables for flask run on Windows?

  1. How to setup environment variables for flask run on Windows?

    you need to provide an application environment. So Flask needs to know, the .py file to run. Try to run that command

  2. setup environment variables for flask run on Windows

    you need to provide an application environment. So Flask needs to know, the .py file to run. Try to run that command

Method 1

Windows PowerShell

set FLASK_APP=hello.py
$env:FLASK_APP = "hello.py"
flask run

Method 2

you need to provide an application environment. So Flask needs to know, the .py file to run. Try to run that command

export FLASK_APP=application.py

where application.py – name of your Flask app in my case it is application.py.

after that

flask run

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read