If you're using contrib.staticfiles app, your DEBUG is True and you're using 
runserver django automagically maps (overrides) your staticfile serving.

If you want to manually add staticfile serving, you have to give --nostatic 
parameter to runserver to omit all magic that happena automatically.


On Mon, 26 Aug 2013 07:58:38 -0700 (PDT)
Wesley Ni <[email protected]> wrote:

> I hit an issue when trying serve static files.
> 
> In settings, debug is True, and with the followinig:
> STATIC_ROOT = os.path.join(freelancer_path,"staticfiles")
> STATIC_URL = '/staticfiles/'
> 
> urls.py:
> (r'^staticfiles/(?P<path>.*)$','django.contrib.staticfiles.views.serve',
>         {'document_root' : STATIC_ROOT,'show_indexes' : True}),
> 
> Problem is, when accessing http://127.0.0.1:8000/staticfiles/, I got this:
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/staticfiles/
> 
> Why? I thought I would get folder indexes because I set show_indexes to 
> True.
> 
> And, later, I find that, if I set the url pattern prefix not same to 
> STATIC_URL, 
> say, maybe :
> (r'^files/(?P<path>.*)$','django.contrib.staticfiles.views.serve',
>         {'document_root' : STATIC_ROOT,'show_indexes' : True}),
> And, then, http://127.0.0.1:8000/files/ is OK to show folder lists.
> 
> Could anyone help explain and fix?
> 
> Thanks.
> Wesley
> 
> -- 
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 

Jani Tiainen

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to