Django MEDIA url in storage.py

56 views
Skip to first unread message

hakim

unread,
May 16, 2012, 9:26:22 AM5/16/12
to django-d...@googlegroups.com
Hi all,

I am developing an intranet portal using django 1.3.1. I noticed in my uploader app that the default storage redirects the saved files to the apache2 directory.
I found later that the reason of this is due to Django.core.files.storage.py in line 152, 154. It still uses settings.MEDIA_URL. The same thing for 1.4.
I fixed it changing it to STATIC_URL. please fix it in the future release.

regards,   

Andre Terra

unread,
May 16, 2012, 9:47:36 AM5/16/12
to django-d...@googlegroups.com
You can define a custom location for your files like the docs tell you:

If you believe you've encountered a bug, please create a ticket on TRAC:


More customization can be achieved by specifying a custom file upload handler:


Cheers,
AT

--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/GatVnD3aRs8J.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.

Gert Van Gool

unread,
May 16, 2012, 10:19:06 AM5/16/12
to django-d...@googlegroups.com
The usage of MEDIA_ROOT is by design.

According to the release notes from 1.3 [1], the intention is to have
uploaded files in MEDIA_ROOT and assets/static files in STATIC_ROOT.

Nothing stops you from doing:

MEDIA_ROOT = STATIC_ROOT
MEDIA_URL = STATIC_URL

[1] https://docs.djangoproject.com/en/dev/releases/1.3/#extended-static-files-handling

-- Gert

Mobile: +32 498725202
Twitter: @gvangool
Web: http://gertvangool.be
Reply all
Reply to author
Forward
0 new messages