On Mon, Feb 18, 2013 at 1:17 PM, frocco <faro...@gmail.com> wrote:

> Hello,
> I have a site under apache www root.
> www
>    mysite
>         templates
>    media
>    static
>
> I am following the two-scoops book.
> The problem is that my app is looking for templates at www/templates
> Here is my settings.
> Thanks
>
> from unipath import Path
> PROJECT_ROOT = Path(__file__).ancestor(3)
>
> MEDIA_ROOT = PROJECT_ROOT.child('media')
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
>
> STATIC_ROOT = PROJECT_ROOT.child('static')
> STATIC_URL = '/static/'
>
> STATICFILES_DIRS = (
> PROJECT_ROOT.child('static'),
> )
>
> TEMPLATE_DIRS = (
> PROJECT_ROOT.child('templates'),
> )
>
> I don't know about unipath.  It might work just fine.  I typically use
> os.path stuff like abspath, dirname, split, and join, or functions I define
> myself for the purpose based on the previous operations.  You can certainly
> see whether they are producing what you expect using "manage.py shell",
> then "from django.conf import settings as s", and "repr(s.TEMPLATE_DIRS)".
>

I will, however, point out that you seem to be confused about static files
(we're talking Django 1.4, yes?).  STATIC_ROOT is the directory that will
be served at STATIC_URL and is also the directory into which the
collectstatic operation of manage.py will write files or links.  You should
never put anything there yourself.  STATICFILES_DIRS are additional places,
beyond the "static" sub-directories of your installed apps, *FROM* which
collectstatic will get the files that it copies or links into STATIC_ROOT.
STATIC_ROOT should never be included in STATICFILES_DIRS.

STATICFILES_DIRS are places where you have put, for example, you site wide
css, non-app related JavaScript, static images like backgrounds and buttons.
STATIC_ROOT is something you arrange for your front end (e.g.; Apache) to
serve, but you never put anything in it except by running manage.py's
collectstatic.

Bill

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to