Hello Dan,

CAUTION: I don't think the is the standard way of doing this but I
have found it to make my code portable and easy to implement.  Your
mileage may very but I have started removing the project name from all
of my code and for this configuration to work you would need to also.

I use the following on apache2 server where /opt/django/bancgi-prod is
the project directory and then I remove the project name from
ROOT_URLCONF in setting so it's equal = 'urls'.  Then in all
applications I import from the app and don't use project name ever.
This is important because my code is now portable.  Project name
doesn't matter except to the starting web server and the applications
can simple be used in any project without having to modify the project
name in any of the code.  I believe that by including project name in
your code you're making it hard to port and it isn't required by the
built in server or by Apache and probably not by anything else but I
don't know.  Again this works for me anyway :) but your mileage may
very.

<VirtualHost *:80>
  ServerName bancgi-prod.western.edu
  ServerAlias bancgi-prod

  <Location "/">
    PythonPath "['/opt/django/bancgi-prod'] + sys.path"
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings
    SetEnv PYTHON_EGG_CACHE "/tmp"
    PythonOption django.root /bancgi-prod
    PythonDebug Off
    Options FollowSymLinks
  </Location>
</VirtualHost>

Hope this helps,
Mark


On Sep 13, 4:39 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> On Sep 14, 7:31 am, Dan06 <dan.king...@yahoo.com> wrote:
>
> > I've 'successfully' deployed django in a development environment on
> > Apache2. While, I've got it to work, I'm
> > thoroughly confused by the PythonPath setting needed for it to work.
>
> > I don't understand why I need to give the directory that contains the
> > django 'project' AND the directory that contains the django
> > 'application' (see PythonPath below), since the directory that
> > contains the django 'project' also contains the django
> > 'application' (see directory structure below).
>
> > Anyone know why I need to specify both 'project' and 'application'
> > directories?
>
> Because you haven't prefixed all your imports or module path
> references in urls.py with the name of the site.
>
> Graham
>
> > PythonPath "['/var/django_projects/', '/var/django_projects/test/'] +
> > sys.path"
>
> > Directory structure:
>
> > var/
> > | django_projects/ <--- General directory for all django work/projects
> > | | test/ <--- Django project directory created by: django-admin.py
> > startproject test
> > | | | test_app1/ <--- Django app directory created by: python
> > manage.py startapp test_app1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to