set environment variable flask app
Open a terminal or command prompt.
Navigate to the directory where your Flask application is located.
Set the environment variable for the Flask application by using the following command:
Replace "your_app_name.py" with the actual name of your Flask application file.
- Optionally, you can set the environment to development mode to enable debugging and automatic reloading:
This step is recommended during development but should be avoided in production.
- Confirm that the environment variable is set correctly by checking the output of the following command:
The terminal should display the name of your Flask application file.
- You can now run your Flask application using the following command:
This command starts the Flask development server, and you can access your application in a web browser at the specified address (usually http://127.0.0.1:5000/).