Why does .flaskenv variables not work with uWSGI but does by running flask by itself?

14 Views Asked by At

I have an interesting problem and I would appreciate if anybody can help me understand logically why this happens. I am creating a simple web application with flask and using a virtual environment for all (literally every specific python package and not installing anything extra for my OS) things. When I load my development script with python app.py the app will recognize the variables in .flaskenv but not when I load my uwsgi server. I am using pip install python-dotenv in my virtual environment as well as pip install uwsgi and uwsgi is not installed on my system, neither local or remote and neither is dotenv.

I am unable to conjure why this would happen exactly, can you help please? I don't know where to go from here. Here's a bit of my code:

at the top of my app.py:

app = Flask(__name__)
app.config["SECRET_KEY"] = uuid.uuid4().hex
musicdir = os.environ.get('MUSIC_DIR')

in my .flaskenv:

# development?
FLASK_ENV=production
# index.py?
FLASK_APP=app.py
# /home/user/Music/?
MUSIC_DIR=static/music
MUSICLIST_PASS=iamapasswd
DBUPDATE_PASS=ffffffffffffffffffffffffffffffffffQ/

I was expecting it to 'just work' and since this happened I do not know where to go from here at all.

0

There are 0 best solutions below