One option is to use flash vars to pass your django app url to your flex SWF on initialization in your HTML page. That way you don't have to rebuild your SWF for different environments. And you may use a django template to render the html that embeds your swf so you can change the url conditionally depending on if debug is set to True or False. Maybe there's a better way, but I'm not that experienced with Flex.
On Mon, Mar 21, 2011 at 6:58 PM, Sells, Fred <fred.se...@adventistcare.org>wrote: > I would appreciate some guidelines on a better way to deploy a > flex/flash frontend with a django backend. > > I've got flex and django working nicely using the Flex HTTPService and > XML and the message content. Probably not as efficient as other methods > but this is an intratnet and performance is not an issue. This is also > my first django app, and although it's grown to be pretty significant, > it still reflects some newbie mistakes. > > I'm deploying on linux and apache and using mod_python (because we've > done that for years and I have not had time to research mod_wsgi). I'm > more of a programmer than a Unix or Apache administrator but we are a > small shop and you gotta do what you gotta do to make it work. > > Some url's have been edited to avoid exposing potentially proprietary > info. > > The problem is that I deploy the client and server separately like this: > > /var/www/html/myapp/index.html launches my Flex app > /var/www/django/mysite/app ... contains my django app. > > This works fine EXCEPT, I need to hardcode the django url into my Flex > App based on my target deploy something like this. > > private static var LOCAL :String = > "http://localhost:7777/django/mysite/app/"; //I use this with the debug > server > private static var QA :String = > "http://mytestserver.mydomain.org/django/mysite/app/"; > private static var PRODUCTION:String = > "http://myprodserver.mydomain.org/django/mysite/app/"; > private static var DJANGO_URL:String =PRODUCTION; > > So I have to edit and rebuild my Flex app for the different > environments. While that's not much effort I know it's just bad > practice. I would like the url's from flex/flash to django to be > relative and thus I guess I should deploy my flash from django, I'm just > a bit confused about the "static" and "media" directories. I am using > django 1.2.4; however I could upgrade to 1.3 if that makes for a cleaner > solution. > > FWIW my apache conf file looks like this. > > <Location "/django/"> > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE app.settings > PythonOption django.root /var/www//django/app > PythonPath "['/var/www/django'] + sys.path" > PythonDebug On > </Location> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.