I am trying to publish my site on an Amazon\'s EC2 Instance, and I keep getting a 500 error. I really dunno why.
//Log Files
[Sun Feb 17 23:12:48
I had the same issue. My libapache2-mod-wsgi was python 2.x and not python 3.x
found the solution here: https://stackoverflow.com/a/28118284/2489042
credits to @nima
$ sudo apt-get remove libapache2-mod-python libapache2-mod-wsgi
$ sudo apt-get install libapache2-mod-wsgi-py3
Warning from @alxs before you copy/paste these commands: If there are python 2 projects running on the server that use wsgi and apache, the above commands will effectively shut them down.
In case someone came here using AWS Lightsail bitnami..
The problem is that 'python install packages in a directory that apache do not see'.
so: packages get installed in '/home/bitnami/.local/lib/python3.8/site-packages/' and Apache looks in '/opt/bitnami/python/lib/python3.8/site-packages/'.
The temporary solution I followed is copying packages to Apache eyes folder with this command 'cp -r /home/bitnami/.local/lib/python3.8/site-packages/* /opt/bitnami/python/lib/python3.8/site-packages/'
I had a similar error just now. It turns out that our Django code was developed on python 3.5, but for some reasons the people who deployed our server setup virtualEnv with python 2.7. We redeployed with python 3.5 and everything worked for us
Below was the error message I received:
$ python serviceStartup.py
Traceback (most recent call last):
File "serviceStartup.py", line 10, in <module>
from django.core.wsgi import get_wsgi_application
ImportError: No module named django.core.wsgi
Hope this will help with anyone seeing a similar error message!
At first glance, I am sorry for my English. I also faced this issue, and I have solved it by changing 'wsgi.py' file to:
import os import django from django.core.handlers.wsgi import WSGIHandler os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eisentask.settings.production") django.setup(set_prefix=False) application = WSGIHandler()
Add this to the Apache configuration file:
WSGIPythonHome /home/ec2-user/.virtualenvs/mysite-main
I am using Centos and the nginx and gunicorn for my project... I had this problem... wsgi file is not reachable maybe it's bcz of the your current directory I changed my current directory and It worked... my project name is coda so I typed
cd coda
and then
gunicorn --bind 0.0.0.0:8001 coda.wsgi