Whenever running my Flask
app on VSCode
I am unable to change the environment to development. I have searched relevant links on this topic and tried all the solutions and combinations of solutions, nothing so far has worked. I would like my app to refresh whenever I make a change in either any of the template files or my app.py file. Here is a list of what I've tried:
- Typing in
"set FLASK_ENV=development"
on my terminal from this stackoverflow solution I am on Windows, so I instead used set - Pip installing
python-dotenv
and creating a.env
or.flaskenv.
file inside my root directory (yes I tried both) then addingFLASK_ENV=development
as well asset FLASK_ENV=development
inside both files (at different times trying all combinations) like this stackoverflow solution mentioned - Editing my main flask app file with the lines mentioned in the solution from list item number two...
if __name__ == '__main__':
app.run(debug=True)
- Yes I have read the documentation for
python-dotenv
here and addedload_dotenv()
after my import statements
See here start of my app.py code:
"""This is my controller"""
import re
from flask import Flask, render_template, request, redirect, session
from cs50 import SQL
from dotenv import load_dotenv
load_dotenv()
from flask_sqlalchemy import SQLAlchemy
# turn the current file into a web application that will listen for browsers requests
# __name__ refers to the current file
app = Flask(__name__)
if __name__ == '__main__':
app.run(debug=True)
And as you can see Environment: production
still shows from terminal window