List Info

Thread: django_root or application_root ?




django_root or application_root ?
user name
2007-10-10 12:19:58
Hi,

I'm a Django newbie (just finished the tutorial on djangobook.com).  I9;m about to try building a blog with Django to learn some more and I was wondering if there's some sort of DJANGO_ROOT that specifies the path to the root of your project.

The djangobook tipped us to use Python';s __file__ for setting the TEMPLATE_DIRS:

import os.path


TEMPLATE_DIRS = (
    os.path.join(os.path.basename(__file__), 'templates'),
)
Is this the preferred/conventional way?

Thanks!
- Hugh

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: django_root or application_root ?
country flaguser name
United States
2007-10-10 13:00:27
On Wed, 2007-10-10 at 10:19 -0700, Hugh Bien wrote:
> Hi,
> 
> 
> I'm a Django newbie (just finished the tutorial on
djangobook.com).
> I'm about to try building a blog with Django to learn
some more and I
> was wondering if there's some sort of DJANGO_ROOT that
specifies the
> path to the root of your project.

Since you won't always have a "project", the
answer is no. A project is
just a convenience. A directory holding some apps, settings
file and URL
configuration file. However, you could quite happily have
your
applications installed anywhere you like in your Python path
and put
your settings and URL conf files somewhere different. This
becomes more
common as you reuse applications. And there's no way for
Python or
Django to know whether you have most things under one
directory (not all
things, since you're already probably using
django.sites.admin, for
example, which isn't installed in your project).

> The djangobook tipped us to use Python's __file__ for
setting the
> TEMPLATE_DIRS:
> 
> 
> import os.path
> 
> TEMPLATE_DIRS = (
>     os.path.join(os.path.basename(__file__),
'templates'),
> )
> 
> Is this the preferred/conventional way?

If it works for you, go for it.

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 django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )