Hi everybody I tried to deploy my django project with apache, mod_wsgi in windows.
I splited my settings.py like this:
- source root folder
- project folder
- apps
- config
- settings
- init.py
- base.py
- local.py
- prod.py
- settings
- init.py
- asgi.py
- urls.py
- wsgi.py
- myenv
- project folder
After I splited settings.py, Mod_wsgi failed to exec python scripts file : 'C:/user/users/desktop/source_root_folder/project_folder/wsgi.py'.
Mod_wsgi also show the exception that Exception occurred processing WSGI script : 'C:/user/users/desktop/source_root_folder/project_folder/wsgi.py'
In Apache24 error log, 'C:/user/users/desktop/source_root_folder/project_folder/wsgi.py' application = get_wsgi_application() error occured.
# project_folder/wsgi.py
import os
from django.core.wsgi import get_wsgi_application
import sys
sys.path.append('C:/Apache24/htdocs/ C:/user/users/desktop/source_root_folder')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_folder.config.settings'
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_folder.config.settings')
application = get_wsgi_application()
how can i deal with those errors? please give me some helps.
CodePudding user response:
you need to specify the *.py settings file:
os.environ['DJANGO_SETTINGS_MODULE'] = 'project_folder.config.settings.init'