I am using Ubuntu 10.04.
I produce a django project under
and make up a wsgi file
setting.wsgi within the same directory
This is actually the content of
import os import sys path = '/home/wong2/Code/python/django2' if path not in sys.path: sys.path.append(path) os.environ["DJANGO_SETTINGS_MODULE"] = "atest.settings" from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler()
here is things i increase my my httpd.conf:
<VirtualHost *:80> ServerName localhost WSGIScriptAlias / /home/wong2/Code/python/django2/setting.wsgi <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all </Directory> <Directory "/home/wong2/Code/python/django2/atest"> Order allow,deny Allow from all </Directory> </VirtualHost>
The issue is, after i visit http://localhost, it states
You do not have permission to gain access to / about this server.
The 2nd directory block does not match in which you have your WSGI script file installed. It's very bad practice though to stay the WSGI script file someplace where source code or any other sensitive files exist, ie., same directory or sub directory. Rather you need to place it inside a sub directory of their own. Thus:
WSGIScriptAlias / /home/wong2/Code/python/django2/atest/apache/setting.wsgi <Directory "/home/wong2/Code/python/django2/atest/apache"> Order allow,deny Allow from all </Directory>
So, create 'apache' subdirectory under 'atest'. Move 'setting.wsgi' into that 'apache' subdirectory and alter config to above.
Your condition also might be triggered by limited permisions in your home directory as Apache cannot see inside.
because it describes these permissions problems in addition to issues like where you can stick your code and also the WSGI script file.