Thanks for the tip!

However, it's a bit strange because it only accepts paths with double
back slashes, instead of the forward slashes required for declaring
the template path for example.

import sys
sys.path.append('E:\\workspace\\myproject\\trunk\\apps')
works....

but:
import sys
sys.path.append('E:/workspace/myproject/trunk/apps')
doesn't work....

Is there a way around that? As I'm storing the absolute path of my
project in a constant variable (with forward slashes), I'd like to do
something like this:

ABSOLUTE_PROJECT_PATH = 'E:/workspace/myproject/trunk/
sys.append(ABSOLUTE_PROJECT_PATH + 'apps/')

TEMPLATE_DIRS = (
    ABSOLUTE_PROJECT_PATH + 'templates/',
)


PS: As you may have guessed, I'm running under Windows.

On Dec 22, 8:03 pm, Matthias Kestenholz <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-12-22 at 00:58 -0800, Julien wrote:
> > Hi there,
>
> > To keep my projects tidy, I'm used to having all my apps in a
> > subfolder "apps".
> > This means that I need to add that subfolder to the pythonpath. I can
> > do this in apache or by doing runserver --pythonpath=apps.
>
> > However, I'd like to extend the pythonpath within the code, for
> > example in settings.py(*). That would save me from altering apache
> > config files and would therefore make deployment a little easier.
>
> > Is that possible, and is it recommended practice?
>
> The python path lives in sys.path (which is a simple list). This means
> that you can add new directories with sys.path.insert(0, 'your/path') or
> sys.path.append('your/path'), whichever you like.
>
> I do this all the time, mainly in the FastCGI caller script, but also in
> settings.py to enable access to middleware classes and templatetags
> which I use in nearly every project.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to