3π
β
I figured out the issue.
For anyone running into this problem on PythonAnywhere, there are two different wsgi.py
files. The first one is found in the same directory as settings.py
(which was the one I was working with), while the other is under the βWebβ tab and linked under the βCode:β section. The latter is the one that needed to be edited. Adding the following to that wsgi.py
file (above the application = get_wsgi_application()
line) got all my environment variables working properly:
from dotenv import load_dotenv
project_folder = os.path.expanduser('~/<insert-your-project-directory-here>')
load_dotenv(os.path.join(project_folder, '.env'))
π€Megan
Source:stackexchange.com