On Jan 17, 2008 6:24 PM, Rodrigo Culagovski <[EMAIL PROTECTED]> wrote:

>
> I am using the following in my urls.py:
>
> (r'^media_/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root':
> os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> Notice the '_' after 'media.
>
> This allows me to access my media folder using for example:
>
> http://127.0.0.1:8000/media_/css/css2.css
>
> However, if i change it to:
>
> (r'^media/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root':
> os.path.join(os.path.dirname(__file__), 'media').replace('\\','/')}),
>
> Notice no '_'  after 'media'.
>
> I get the following error, trying to access 'http://127.0.0.1:8000/
> media/css/css2.css' I get:
>
> Page not found: C:\Python24\lib\site-packages\django/contrib/admin/
> media\css/css2.css
>
> So apparently when accessing 'media' it gets sent to '/contrib/admin/
> media' instead of my media folder.
>

When using the development server, any urls that start with the setting's
ADMIN_MEDIA_PREFIX (which defaults to /media/) are intercepted and served up
by the AdminMediaHandler out of the contrib/admin/media tree under the
Django install directory.  So if you want to put you own media under urls
that start with /media/, you need to change ADMIN_MEDIA_PREFIX to something
else.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to