On 12/12/2010 7:14am, jc wrote:
Apache&  mod_wsgi are configured correctly (I've created a hello
world .html apache file and a hello world mod_wsgi application with
no
problems). I know need my Django app to recognize my django.wsgi
file.
What makes me think that it's not recognizing my wsgi file is that I
went into my django.wsgi file I created and completely deleted all of
the code in the file and restarted Apache and it still gives me the
same page (a listing of the files from Django app, not my actual
Django application. Configuring Apache and mod_wsgi went really well
but I'm at a loss of how to fix this. Here are some details instead of
"it's
not working":

You are correct. Apache is not looking at the wsgi script. Have a look at the suggestions below ... before playing with django.wsgi.


Here is my current django.wsgi file:

import os
import sys
sys.path.append('/srv/www/duckling.org/store/')
os.environ['PYTHON_EGG_CACHE'] = '/srv/www/duckling.org/
store/.python-
egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I've tried a few different versions of the django.wsgi file
(including
a version like the one over at http://www.djangoproject.com/).
This version of my wsgi is from here:
http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10...


Also, here is my vhost apache configuration file below. I think these
are
the main files that are suppose to do the job for me. Let me know if
you see any errors in what I'm doing and what else I might do to fix
this. The django app runs fine on the django's built-in development
server so I'm thinking it *might have* something with my paths.
No errors in my apache error.log file as well. It's acting as there's
no problem at all, which is not the case...the project isn't loading,
like I said just a listing of my files and directories of my Django
project. Here is my apache config file:

<VirtualHost 1.2.3.4:80>
     ServerAdmin [email protected]
     ServerName duckling.org
     ServerAlias www.duckling.org

     DocumentRoot /srv/www/duckling.org/store/

# DocumentRoot is where you keep non-django stuff eg., static files
# which is served by Apache without needing your Django code
DocumentRoot /srv/www/duckling.org/htdocs/


     <Directory /srv/www/duckling.org/store/>
     Order Allow,Deny
     Allow from all
     </Directory>

# now let the public access anything here
 <Directory /srv/www/duckling.org/htdocs/>
  AllowOverride None
  Order deny,allow
  Allow from all
 </Directory>


     WSGIScriptAlias /django /srv/www/duckling.org/store/wsgi-scripts/
django.wsgi
     <Directory /srv/www/wsgi-scripts>
     Order allow,deny
     Allow from all
     </Directory>
</VirtualHost>


Somewhere in your Apache config you have denied access to the entire filesystem to prevent outsiders from hacking in. Your Django code must also be hidden from outsiders so it will live safely in /srv/www/duckling.org/store because you haven't allowed anyone except Apache to see it.

Now you need to provide an allowed conduit to your Django code. So make an Apache script alias to map the website root (ie '/') to your Django code. Because you are using mod_wsgi the entry point is your django.wsgi script. So map / to the script:
 WSGIScriptAlias / /srv/www/duckling.org/store/wsgi-scripts/django.wsgi

# and give the public full access - but only to the entry point
 <Directory /srv/www/duckling.org/store/wsgi-scripts/>
  Order deny,allow
  Allow from all
 </Directory>

hth
Mike


And here are versions of the stack that I'm using, I saw over at the
mod_wsgi site that you all would like the versions of what I'm using
on the server:
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch
mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8

I would remove mod_python if possible


thanks,
j.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to