Sorry but it still doesn't work. http://stackoverflow.com/questions/4730716/django-static-files-problem Here also mentioned the issue that pattern conflicts with STATIC_URL.
在 2013年8月26日星期一UTC-4下午1时28分42秒,mantaszilinskis写道: > > 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 <[email protected]<javascript:> > > 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> 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 [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.

