On Wed, 2007-03-07 at 02:16 -0800, char wrote:
> Just wondering about something. When configuring PythonPath in
> httpd.conf to get mod_python to work with Apache, is it normal to have
> to specify both the directory that contains your project directory as
> well as the project directory itself? I had to in order to get
> everything to work. I also notice that both are specified in sys.path
> when you run manage.py, but none of the documentation or mailing list
> threads I came across seemed to indicate the need for this.

You don't need to specify both. However, you will have to set up your
import paths carefully if you only specify one of them. The manage.py
setup is a bit generous: it enables you to do both

        from myproject.myapp import models
        
and

        from myapp import models

without caring. However, you can only use the first form is the
directory containing myproject/ is on your Python path and you can only
use the latter if the myproject/ directory itself is on your Python
path. So, providing you are consistent and always import from, say,
myproject.*, you only need the parent of myproject/ on your Python path.


> Specifically, I needed to write:
> 
> <Location "/">
>     SetHandler python-program
>     PythonHandler django.core.handlers.modpython
>     PythonPath "['/home/myhome', '/home/myhome/myproject'] + sys.path"
>     SetEnv DJANGO_SETTINGS_MODULE myproject.settings

You need the first one because your are doing this import. Unless you
changed your settings file, some of the settings inside the file will
also assume you can run "import myproject". For example, the root url
configuration setting.

You need the second one because I suspect you are leaving off the
"myproject" part of the import path somewhere inside your code. You
could track those down and save yourself one path addition if you wanted
to.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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