Apache is not interpreting python files

77 views Asked by At

So, I followed this tutorial on Ubuntu 14.04 http://jee-appy.blogspot.in/2015/04/deploy-django-project-on-apache-using.html Only thing I changed is instead of his example repository,I have used mine. And I was getting error

Not Found The requested URL / was not found on this server.

Then, I edited my myproject.conf file Change made - WSGIScriptAlias /myproject /var/www/myproject.wsgi So, I'm having output Index of/ then directory and file name. it's not interpreting my python files.

1

There are 1 answers

0
Bit68 On

Had the same issue and I modified my wsgi file to look like this:

import os
import sys

path = '/var/www/html/YOURAPP/'
if path not in sys.path:
    sys.path.append(path)

path = '/var/www/html/YOURAPP/YOURAPP/'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'YOURAPP.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Hope this helps