Unable to set up Django 1.1.2 using WSGI, on ubuntu 10.04

Hi,

I need your help in setting up Django with mod-wsgi ( on ubuntu 10.04 ), and I apologize for this really long post.

I am having problems with setting up Django on my linode based on the tutorials found at http://library.linode.com/development/f … 0.04-lucid">http://library.linode.com/development/frameworks/python/django/apache-mod-wsgi-ubuntu-10.04-lucid and http://library.linode.com/development/f … 0.04-lucid">http://library.linode.com/development/frameworks/python/django/apache-mod-wsgi-ubuntu-10.04-lucid

the directory set up was also based on the tutorial.

It seems that WSGI is unable to import my views, although it is there and working on my local computer. My django project works previously ( when i was using mod_python on ubuntu 10.04 ), so I am very sure that my views.py for my apps are all there and conrrectly configured.

I need you to have a look at: http://www.tabbing.me, and than try clicking on the links "Overview" or "Archives". You will receive a Django error page.

What seems weird is that the META data is showing some wrong values. On the error page, you will see that

PATH_TRANSLATED    :
'/srv/www/tabbing.me/django/tabshift/django.wsgi/rapidtask/quadrant_view/'

But what I need is (notice that there is no django.wsgi)

'/srv/www/tabbing.me/django/tabshift/rapidtask/quadrant_view/'

My configuration are almost the same based on the tutorials in this post:

#

At: /srv/www/tabbing.me/django/tabshift/django.wsgi

import os
import sys

wsgi_dir = os.path.abspath(os.path.dirname(__file__))
project_dir = os.path.dirname(wsgi_dir)
sys.path.append(project_dir)

project_settings = os.path.join(project_dir,'settings')

os.environ['PYTHON_EGG_CACHE'] = '/srv/www/tabbing.me/.python-egg'
os.environ['DJANGO_SETTINGS_MODULE'] = 'tabshift.settings'

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

At: /etc/apache2/sites-available/tabbing.me :

 <virtualhost 173.230.150.63:80="">ServerAdmin netosis@gmail.com
ServerName tabbing.me
ServerAlias www.tabbing.me
DocumentRoot /srv/www/tabbing.me/django/tabshift

WSGIScriptAlias / /srv/www/tabbing.me/django/tabshift/django.wsgi

Alias /blog /srv/www/tabbing.me/public_html/blog
Alias /public_media /srv/www/tabbing.me/django/tabshift/public_media

ErrorLog /srv/www/tabbing.me/logs/error.log
CustomLog /srv/www/tabbing.me/logs/access.log combined</virtualhost> 

Please help~~ What webt wrong? Why is WSGI not able to import my views.py when its there?

any advice or tutorials are more than welcomed!

Best Regards,

Eugene

3 Replies

Where you have:

wsgi_dir = os.path.abspath(os.path.dirname(__file__))
project_dir = os.path.dirname(wsgi_dir)
sys.path.append(project_dir)

I use:

if os.path.dirname( os.path.realpath( __file__ ) )  not in sys.path:
    sys.path.append(os.path.dirname( os.path.realpath( __file__ ) ) )

James

Here is a Python WSGI testing framework that does not require a web server installation, seems interesting. I'm going to try it out today.

http://pythonpaste.org/webtest/

James

Note from the README that the source code repository has changed:

Development no longer occurs in this repository

Please see:

http://bitbucket.org/ianb/webtest

Check out with:

hg clone http://bitbucket.org/ianb/webtest

Download from:

http://bitbucket.org/ianb/webtest/get/tip.gz

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct