Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:47:54+00:00 2026-05-16T07:47:54+00:00

I am creating a django-based site that will serve flash apps that occasionally access

  • 0

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:

  1. 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.
  2. 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:

  1. A way of having the html and swf files be released to different locations. (I don’t know how to do this.)
  2. 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?)
  3. 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:

  1. Is the above the best way of doing this, or is this even the right direction?
  2. If so, how do I release the html and swf to different directories? (For debug and release mode, if there are two different methods.)
  3. 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. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:47:55+00:00Added an answer on May 16, 2026 at 7:47 am

    Finally figured this out myself. A combination of this and django get-parameters works. The general take-away:

    1. You can put {% tags %} and {{ variables }} in index.template.html without worry, as there is no way to customize the currently-existing macros there like ${title}
    2. If you make a foo.template.html and foo-debug.template.html in the html-template directory of your project, then the former will override index.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.)
    3. You can pass the name of the SWF in a parameter to django, and have it fill in the directory for you

    foo-debug.template.html

    <object ...
      <param name="movie" value="{{ bin_debug_url }}/${swf}.swf" ...
    

    djangoflash.html

    {% block content %}
      {% include flash_template %}
    {% endblock %}
    

    views.py

    def djangoflashview( request, **kwargs ):
      if not kwargs.has_key('extra_context'):
        kwargs['extra_context'] = {}
      if request.GET.has_key('name'):
        debug = "-debug" if request.GET.has_key('debug') else ""
        bin_debug_dir = '/dir-to-bin-debug/'
        bin_debug_url = 'url-to-bin-debug'
        name = bin_debug_dir + request.GET['name'] + debug + '.html'
        kwargs['extra_context']['flash_template'] = name
        kwargs['extra_context']['bin_debug_url' ] = bin_debug_url
      return direct_to_template( request, **kwargs ) 
    

    urls.py

    url( r'^djangoflash/', 'views.djangoflashview', 
         { 'template': 'djangoflash.html' }
    

    foo.mxml’s run-debug target:

    /url-to-django/djangoflash/?name=foo
    

    When you debug foo.mxml, flex:

    1. Adds &debug=true to the url
    2. Brings up a browser to /url-to-djangoflash/djangoflash/?name=foo&debug=true
    3. Which picks djangoflash/ in urls.py
    4. Which passes the request to djangoflashview and {'name':'foo','debug':'true'} to request.GET in views.py
    5. Which figures out the name and location of the foo-debug.html location, passing it to the flash_template context variable
    6. And the url of the swf to the bin_debug_url context variable
    7. And loads up the direct template djangoflash.html
    8. Which, in djangoflash.html, includes the foo-debug.html wrapper for flash using the flash_template context variable
    9. Which, in turn fills in the bin_debug_url context variable to point the foo.swf reference correctly to the thing you just compiled

    Whew. 😛

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.