Op 26-jan-2011, om 06:46 heeft Brian Neal het volgende geschreven:

> Hi -
> I'm trying to cut over my project to use the new staticfiles
> application. I'm using the dev server with DEBUG = True on a recent
> SVN trunk checkout. My STATIC_URL is '/static/' and my MEDIA_URL is
> 'http://localhost:8000/media/' in this environment.

STATIC_URL and MEDIA_URL are two different things.

if you want to serve static files that are related to your 
webdesign/development you should use STATIC.
User related files such as uploaded files such be placed inside the MEDIA path.

so change STATIC_URL into MEDIA_ROOT='static/'. I always use a fullpath when 
defining a MEDIA_ROOT or STATIC_ROOT.

> 
> My first confusion point:
> Maybe it was just me, but I got confused about serving my media
> (MEDIA_ROOT/MEDIA_URL) files with the dev server. After cutting over
> to staticfiles, my MEDIA_URL files started getting 404s. Eventually I
> came to the conclusion that I had do this:
> 
> urls.py:
> if settings.DEBUG:
>   urlpatterns += patterns('django.contrib.staticfiles.views',
>      (r'^media/(?P<path>.*)$', 'serve', {'document_root':
> settings.MEDIA_ROOT}),
>   )

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

Reply via email to