user11726874
user11726874

Reputation:

dotenv module not found error pythonanywhere

I have a pythonanywhere flask application setup. Everything works fine except for dotenv. I installed it using pip install python-dotenv on python 3.7 while my virtual environment was activated. I still get the module not found error though. Any solutions?

Upvotes: 0

Views: 654

Answers (1)

user11726874
user11726874

Reputation:

It turns out I had to import dotenv in the var/www/www_my_web_app_wsgi.py file and load the environment variables from then and from my app.py use os.getenv to access them. Everything works perfect now.

Upvotes: 2

Related Questions