python - Trying to settup Django on Apache2: 'not able to import' django.core.wsgi -


my django set-up works locally, when try run apache2 on ubuntu , go ip, gives me 500 internal error message internal server error

"the server encountered internal error or misconfiguration , unable complete request."

checking error logs see there problem 'django.core.wsgi'. error message being:

traceback(most recent call last):, referer: http://my-ip-address/ [sun jan 24 15:32:56.099311 2016] [wsgi:error] [pid 9919:tid 139760998606592]

[client 86.45.29.184:53665] file "/home/user/my_django_project/my_django_project/wsgi.py", line 17, in , referer: http://my-ip-address/

[sun jan 24 15:32:56.0993522016] [wsgi:error] [pid 9919:tid 139760998606592 >[client 86.45.29.184:53665] django.core.wsgi import get_wsgi_application, referer: http://my-ip-address/

[sun jan 24 15:32:56.099364 2016] [wsgi:error] [pid 9919:tid 139760998606592] [client 86.45.29.184:53665] importerror: no module named django.core.wsgi, referer: http://my-ip-address/

my etc/apache2/sites-enabled folder has my_django_project.conf file, settup as:

wsgiscriptalias / /home/user/my_django_project/my_django_project/wsgi.py wsgipythonpath /home/user/my_django_project  <directory /home/user/my_django_project/my_django_project>     <files wsgi.py>         order deny,allow         require granted     </files> </directory>  alias /media/ /home/user/my_django_project/django_proj/media/ alias /static/ /home/user/my_django_project/django_proj/static/  <directory /home/user/my_django_project/django_proj/static>     require granted </directory>  <directory /home/user/my_django_project/django_proj/media>     require granted </directory> 

my wsgi.py file looks like:

""" wsgi config my_django_project project.  exposes wsgi callable module-level variable named ``application``.  more information on file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """  import os, sys  sys.path.append('/home/user/.local/lib/python2.7/site-packages')  sys.path.append('/home/user/my_django_project/my_django_project')   django.core.wsgi import get_wsgi_application  os.environ.setdefault("django_settings_module", "my_django_project.settings")  application = get_wsgi_application() 

thank reading :d


Comments