andersra
andersra

Reputation: 1135

Trouble with Apache, mod_wsgi, and Django configuration

Just set up a 64 bit ubuntu EC2 instance using the Bitnami DjangoStack image.

So far I have installed a few python dependencies and removed the Project django app which was created by default. I created a new app with 'django-admin.py startproject projectname'. I then followed the instructions here: http://wiki.bitnami.org/Components/Django, attempting to setup apache.

Here is my projectname.conf file:

Alias /static "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/contrib/admin/static"

<Directory '/opt/bitnami/apps/django/lib/python2.7/site-packages/django/contrib/'>
Order allow,deny
Allow from all
</Directory>

WSGIScriptAlias /URL_mount_point "/opt/bitnami/apps/django/scripts/projectname.wsgi"

<Directory '/opt/bitnami/apps/django/scripts'>
Order allow,deny
Allow from all
</Directory>

Here is my projectname.wsgi

import os, sys
sys.path.append('/opt/bitnami/apps/django/django_projects')
sys.path.append('/opt/bitnami/apps/django/django_projects/projectname')
os.environ['DJANGO_SETTINGS_MODULE'] = 'projectname.settings'

import django.core.handlers.wsgi

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

Here are the last three lines of my httpd.conf:

Include "/opt/bitnami/apache2/conf/ssi.conf"
Include "/opt/bitnami/apache2/conf/bitnami/httpd.conf"
Include "/opt/bitnami/apps/django/conf/projectname.conf"

After doing this and restarting apache, hitting mydomain.com/projectname still comes up with a 404 (the Bitnami landing page comes up just fine at mydomain.com).

Am I missing something here? Are my paths in projectname.wsgi incorrect (I have not strayed from the default Bitnami directory structure). Or is there some additional step I am missing here?

Upvotes: 0

Views: 461

Answers (2)

andersra
andersra

Reputation: 1135

I added this to my httpd.conf

    WSGIScriptAlias / /opt/bitnami/apps/django/scripts/projectname.wsgi
<Directory '/opt/bitnami/apps/django/django_projects/projectname'>
    Order allow,deny
    Allow from all
</Directory>

and that seemed to fix it.

Upvotes: 1

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

You should be accessing:

http://mydomain.com/URL_mount_point

Since it appears you have not shown your original configuration, hard to say whether that is the issue or whether is a typo of sorts.

Upvotes: 1

Related Questions