Closed GoogleCodeExporter closed 9 years ago
Actually, you can achieve the same by setting your MEDIA_URL in your settings
depending on the value of on_production_server. Also, I'm not so happy about
using
"appspot.com" (we use a different subdomain instead).
BTW, instead of using @register.tag you should try @register.simple_tag. That's
much
easier.
Original comment by wkornew...@gmail.com
on 22 Mar 2009 at 12:23
> Also, I'm not so happy about using "appspot.com" (we use a different subdomain
instead).
You map the same app-engine application to two separate apps-for-your-domain
domains?
I never thought of that, as the appspot domain isn't really visible for style
sheets
etc. But that's a fair use case.
It isn't as easy as as just using on_production_server in settings.py to set
MEDIA_URL though. For example, if you access /login using https on the appspot
domain, then the page will generate warnings because the media is being served
via a
non-ssl domain.
Similarly, if you access your app via it's staging URL at
appid.version.appspot.com
you will get stale media from static.example.com, which will be an alias for
appid.appspot.com.
The media_url tag handles this.
> BTW, instead of using @register.tag you should try @register.simple_tag.
That's
much easier.
They aren't quite the same thing. @simple_tag does it's processing during the
render
phase, whereas the media_url tag does it's processing during the compile phase
and
generates a TextNode, which has the simplest possible render phase.
This doesn't make much difference at the moment for app-engine-patch as it is
not
caching templates, but it should. Take a look at
google/appengine/ext/webapp/template.py for an example. (This was going to be
my
next patch, if your interested in adding this)
Original comment by sdeasey
on 22 Mar 2009 at 1:33
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
[deleted comment]
> It isn't as easy as as just using on_production_server in settings.py to set
MEDIA_URL though. For example, if you access /login using https on the appspot
domain, then the page will generate warnings because the media is being served
via a
non-ssl domain.
If your app runs on an appspot domain you don't need to change MEDIA_URL,
anyway. ;)
Also, it's easy to set "http://..." for on_production_server.
The only real problem is indeed with staging URLs, but even your current
media_url
implementation would act incorrectly (using stale version from
appid.appspot.com).
You'd have to detect whether the app is accessed via a versioned appspot.com
domain
and handle that case appropriately. But since MEDIA_URL also has to be
available at
the JavaScript level (site_data.settings.MEDIA_URL) this can't work magically
with a
media_url tag, anyway. You just have to set MEDIA_URL in your settings. At
least, I
can't promote media_url if it's not compatible with the media generator's
site_data
feature.
Regarding template caching, you should send the code to Django. It's definitely
a
cool feature and a shame that Django doesn't have it.
Original comment by wkornew...@gmail.com
on 22 Mar 2009 at 3:55
Original issue reported on code.google.com by
sdeasey
on 21 Mar 2009 at 12:51