Reputation: 89
I am currently setting up a django application with python3 on AWS Elastic-Beanstalk, but I am having issues with configuring the wsgi.py file for the application. Why am I having the error: ERROR: Your WSGIPath refers to a file that does not exist.
?
When running eb config I set the wsgi path to WSGIPath: pronet/pronet/src/pronet/wsgi.py
Is the issue with my wsgi.py script, eb config wsgi settings, or not having the django module installed?
"""
WSGI config for pronet project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pronet.settings.production")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Wrap werkzeug debugger if DEBUG is on
from django.conf import settings
if settings.DEBUG:
try:
import django.views.debug
import six
from werkzeug.debug import DebuggedApplication
def null_technical_500_response(request, exc_type, exc_value, tb):
six.reraise(exc_type, exc_value, tb)
django.views.debug.technical_500_response = null_technical_500_response
application = DebuggedApplication(application, evalex=True,
# Turning off pin security as DEBUG is True
pin_security=False)
except ImportError:
pass
[Tue Oct 18 18:59:52.882790 2016] [:error] [pid 25763]
[remote 172.31.5.99:148] mod_wsgi (pid=25763):
Exception occurred processing WSGI script
'/opt/python/current/app/pronet/src/pronet/wsgi.py'.
[Tue Oct 18 20:01:21.096064 2016] [:error] [pid 25763]
[remote 172.31.46.245:148] ImportError: No module named 'django'
[Tue Oct 18 20:01:21.478180 2016] [:error] [pid 25763]
[remote 172.31.46.245:60132] mod_wsgi (pid=25763):
Target WSGI script '/opt/python/current/app/pronet/src/pronet/wsgi.py'
cannot be loaded as PytExamine: sing WSGI script '/opt/python/current/app/pronet/src/pronet/wsgi.py'.
I changed the wsgi path to WSGIPath: pronet/src/pronet/wsgi.py, and now I received this message in the eb logs. Does this mean the wsgi.py is found?
[Tue Oct 18 20:53:09.711239 2016] [so:warn] [pid 31697] AH01574: module wsgi_module is already loaded, skipping
Upvotes: 0
Views: 934
Reputation: 635
This is usually due to the way your app directory is structured. Most of the time its due to the method you use to zip the folder for deployment. Instead of zipping the parent folder, try to select the items inside root directory and then zip.
Upvotes: 0