Archive

Archive for March 14th, 2008

Django through Apache on Ubuntu

March 14th, 2008 No comments

To: /etc/apache2/httpd.conf
Add:

<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE <project>.settings
PythonDebug On
PythonPath "['/parent', '/parent/project'] + sys.path"
</Location>

I found the instructions a bit confusing on the site. So I hope this clears up things a bit. My thought is they think the setup for live systems and where those files reside is different in the minds of the developers although that pathway isn’t really brought to light in the docs. It’s kind of hinted at, but here it goes.

In order to get my project up on Apache I had to include both the path for my project as well as its parent. The reason being is that it needs to be able to tie into your settings.py file and wants to know the project that’s a part of. In order to get that relationship it needs the folder of the project itself. I also added the path for the project so that it could tie into the applications.

What this means.
Replace <project>: with the name of your project
Replace /parent:  with the directory of the parent directory to your project
Replace /parent/project: with the directory of your project
Save the file and then restart apache:

apache2ctl restart

Categories: Apache, Django, Ubuntu Tags:

Installing Django from SVN and setting up django-registration (on Ubuntu)

March 14th, 2008 No comments

Go to the shell and navigate to a directory that you want to leave the Django codebase. then enter the following code to check out the current codebase from Django:
svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

Next you will need to make a symbolic link to the Django codebase:

sudo ln -s `pwd`/django-trunk/django/ /usr/lib/python2.5/site-packages/django

Link to django-admin, which is used to create Django projects:

sudo ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/bin

Make sure not to use regular apostrophes around pwd or else you could run into an error with your libraries.  I was getting this error (since the mapping was going to the wrong place)
Traceback (most recent call last):

File "manage.py", line 2, in <module>
from django.core.management import execute_manager
ImportError: No module named django.core.management

Django registration

svn checkout http://django-registration.googlecode.com/svn/trunk/registration/ registration/
sudo ln -s `pwd`/registration /usr/lib/python2.5/site-packages/registration

Categories: Django, Linux, MSSQL, Ubuntu Tags: