On May 27, 2010, at 9:23 AM, Luke Plant wrote:

> A Django 1.3 proposal.  It is a pretty small feature/change in some 
> ways, but needs some discussion.
> 
> = Motivation =
> 
[...]

I am on board with the motivation here. The reasons given are exactly why
we made a similar change to Pinax.

> = Options =
> 
> We could:
> 1) add 'STATIC_URL' and use it for widgets and all other media.
> 2) add 'USER_MEDIA_URL' and 'USER_MEDIA_ROOT' and use them for file 
> storage.

I am torn between these two. I am in favor of both to some extent. I like the
direction of being more clear about which is used by FileFields. On the other
hand calling the static resources for a site STATIC_* seems the most correct
to me.

Of course Pinax had to take some direction and since we couldn't go changing
all the FileFields of the world we had to introduce new settings. My stance
would definitely favor option 2 for the added clarity it provides. Pinax could
end up with best of both worlds ;-)

> (using backwards compatible defaults either way).
> 
> If 1), then, additionally, do we need 'STATIC_ROOT' as well?  What 
> for? It wouldn't be used anywhere in Django.

For Pinax we added STATIC_ROOT because we support a command called
build_static which collects static files from apps and writes them to
STATIC_ROOT. It has worked *extremely* well for us, but I don't think you
are looking at going this far yet. If so, under option 2 essentially
MEDIA_ROOT could serve that purpose. However, going with option 2 would make
MEDIA_ROOT obsolete until something like this is added? Might make that a bit
tricky.

> I strongly suspect that static media are far more common than user 
> uploaded files, so doing 2) will require far fewer changes to existing 
> apps.  Also, I suspect that almost all direct use of MEDIA_URL in apps 
> will be for static media: file fields provide a URL attribute which 
> automatically includes MEDIA_URL, but it will be common to use 
> MEDIA_URL for calculating URLs (e.g.  in templates).

This is a decent assumption as when I went through my code to move to
STATIC_URL it was largely changing all MEDIA_URL references.

> Also, use of 'media' for static media is consistent with 
> ADMIN_MEDIA_PREFIX, which is lost with option 1)

Good point.

> Finally, once these things are sorted out, is this a small enough 
> change that I should go ahead and commit it, or should I wait for 
> voting on Django 1.3 features?

I suppose this is dependent on whether we want to introduce app media handling
or if we want this to separate from that. In my opinion I can see them as two
different bits that be done independently.

Brian Rosner
http://oebfare.com
http://twitter.com/brosner

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

Reply via email to