-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwsgi_config.py
More file actions
30 lines (24 loc) · 993 Bytes
/
wsgi_config.py
File metadata and controls
30 lines (24 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# PythonAnywhere WSGI configuration
# Paste this into your PythonAnywhere WSGI file at:
# /var/www/xenohuru_pythonanywhere_com_wsgi.py
#
# In the PA Web tab, click "WSGI configuration file" link and replace ALL content with this.
import sys
import os
# Project root on PythonAnywhere
PROJECT_ROOT = '/home/xenohuru/main'
# Add project root to sys.path so Django can find 'cofig' and 'app.*'
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
# Load environment variables from .env
env_file = os.path.join(PROJECT_ROOT, '.env')
if os.path.exists(env_file):
with open(env_file) as f:
for line in f:
line = line.strip()
if line and not line.startswith('#') and '=' in line:
key, _, value = line.partition('=')
os.environ.setdefault(key.strip(), value.strip())
os.environ['DJANGO_SETTINGS_MODULE'] = 'cofig.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()