I am creating a django-based site that will serve flash apps that occasionally access data via pyamf. I need to be able to easily test the flash in the context of the django framework, i.e. with all the login cookies and everything available, so that when I make a pyamf call, it has all the user context there. And I need to be able to test and release both the swf's and the wrapper html's in a sane way. However:
- The html templates in flex are already templates, so if I put template code in there for django, it gets scraped out before the flashapp.html is created.
- The html's and swf's automatically get released to the same directory, but I want them to go to different directories because the swf's shouldn't be served by django and the html's should be in an area in control of django.
This leads me to believe, at first glance, that I need:
- A way of having the html and swf files be released to different locations. (I don't know how to do this.)
- A way of releasing the html's as stubs (no html/body tag) so that I can include them from another location in django. (I guess just strip what I don't want from the index.template.html?)
- Then I can point flex to go to the django site that in turn includes the generated flashapp.html that in turn references the swf, and it should all work. (By feeding that alternate html to the run/debug settings, I assume.)
So my question comes down to:
- Is the above the best way of doing this, or is this even the right direction?
- If so, how do I release the html and swf to different directories? (For debug and release mode, if there are two different methods.)
- If not, what is proper?
And if there are any other general bits of advice for me on this topic, please feel free to share. :-)
Finally figured this out myself. A combination of this and django get-parameters works. The general take-away:
{% tags %}
and{{ variables }}
inindex.template.html
without worry, as there is no way to customize the currently-existing macros there like${title}
foo.template.html
andfoo-debug.template.html
in thehtml-template
directory of your project, then the former will overrideindex.template.html
for release builds, and the latter for debug builds (note that the result will be foo-debug.html instead of foo.html though.)foo-debug.template.html
djangoflash.html
views.py
urls.py
foo.mxml's run-debug target:
When you debug foo.mxml, flex:
&debug=true
to the url/url-to-djangoflash/djangoflash/?name=foo&debug=true
djangoflash/
inurls.py
djangoflashview
and{'name':'foo','debug':'true'}
torequest.GET
inviews.py
foo-debug.html
location, passing it to theflash_template
context variablebin_debug_url
context variabledjangoflash.html
djangoflash.html
, includes thefoo-debug.html
wrapper for flash using theflash_template
context variablebin_debug_url
context variable to point the foo.swf reference correctly to the thing you just compiledWhew. :-P