0

I have a Django application which I am able to run successfully from my development server. I would like to deploy it to Apache web server. The following is my development and deployment setup:

Windows 7
Python 2.7.8
Django 1.6
mod_wsgi 3.5
Apache 2.4

After going through the steps given in the Django documentation, I configured my Apache accordingly and tried running the application, but I get a 'Bad Request' error. The following is the configuration in my httpd.conf file for the Django and WSGI settings:

WSGIScriptAlias / C:/RAKESH/projects/dias/dias/wsgi.py
WSGIPythonPath C:/RAKESH/projects/dias

<Directory C:/RAKESH/projects/dias/dias>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

The following is the contents of wsgi.py file in my project:

import os
import sys
sys.path.append('C:/RAKESH/projects/dias')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dias.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

I don't see any error in my error.log file of Apache, but the following warning lines were present:

[Mon Dec 22 20:34:48.012626 2014] [:warn] [pid 3868:tid 352] mod_wsgi: Compiled for Python/2.7.6.
[Mon Dec 22 20:34:48.012626 2014] [:warn] [pid 3868:tid 352] mod_wsgi: Runtime using Python/2.7.8.

Is there anything else I am missing here? I tried following suggestions in this thread, this thread but it didn't solve the problem. Can anyone please help me solve this problem?

Thanks, Rakesh.

Community
  • 1
  • 1
Rakesh K
  • 8,237
  • 18
  • 51
  • 64
  • 1
    At a very minimum, it seems like your wsgi file is using commands from Django 1.7 (get_wsgi_application). 1.6 should be something like: `import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()` – user Dec 22 '14 at 15:23
  • No no, I am pretty sure it's 1.6 – Rakesh K Dec 22 '14 at 16:10

0 Answers0