Viktor
Viktor

Reputation: 580

Mod_wsgi , django and apache not working correctly

Configuration :

Application location: /home/cha0s/hello

Wsgi file directory: /home/cha0s/hello/apache/django.wsgi

django.wsgi

import os
import sys


path = '/home/cha0s/hello'
if path not in sys.path:
    sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODEULE']='hello.settings'



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

Apache file : /etc/apache2/sites_available/hello

hello

<VirtualHost *:80>

    ServerName blabla.com
    DocumentRoot /home/cha0s/hello




    WSGIScriptAlias http://blabla.com /home/cha0s/hello/apache/django.wsgi

    <Directory /home/cha0s/hello/apache>
        Order allow,deny
        Allow from all
    </Directory>


</VirtualHost>

Question:

So the problem is it kind of works , but it opens directory just like a list of files , not like a django website. Any idea whats wrong? I read somewhere on stackoverflow that mod_python may be the problem , so i deleted it .

Upvotes: 1

Views: 7484

Answers (2)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

You need to add '/home/cha0s' to sys.path.

Also go watch:

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

This explains other things you could have got wrong, but since you don't explain what the error is you are getting, hard to tell what else is broken.

Upvotes: 1

Daniel Roseman
Daniel Roseman

Reputation: 599450

Your WSGIScriptAlias line is nonsense. It's a path, not a URL. Should be:

WSGIScriptAlias / /home/cha0s/hello/apache/django.wsgi

Also, you've misspelled DJANGO_SETTINGS_MODULE in the wsgi file.

Upvotes: 4

Related Questions