import settings instead of 'document_root' : STATIC_ROOT, try 'document_root' : settings.STATIC_ROOT,
On Mon, Aug 26, 2013 at 10:05 AM, Wesley Ni <wesley.ni...@gmail.com> wrote: > Forget to say that I use Django 1.5.2 > > 在 2013年8月26日星期一UTC-4上午10时58分38秒,Wesley Ni写道: > >> 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/<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/<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 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. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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. For more options, visit https://groups.google.com/groups/opt_out.