I've been looking to see how to create a mobile version of a project on Webfaction. Some prerequisites: 1. Using virtualenv 2. mod_wsgi 3. Want to use the same views and models, but different templates 4. Templates will be grabbed by changing the template_dirs setting in different settings files. For example: settings and settings_mobile So I thought I could do all this with VirtualHosts, but I keep getting stuck trying to get the wsgi files to see settings. It just keeps displaying the wsgi hello world message. Anyone see something I'm doing wrong in my .conf file? Please let me know what you think.
asked 05 Nov '10, 00:59 davemerwin |
I think klynton means something like this as a middleware:
This way you can run one django app but still use two sets of templates. answered 05 Nov '10, 02:16 lamusoftware That is exactly what I meant! Thank you!
(05 Nov '10, 02:30)
klynton
Oh, that is RAD. Then I don't have to futz with apache. I'm going to play with that. Thanks for the idea.
(05 Nov '10, 17:23)
davemerwin
I suppose my initial concern with this is, if the site is under heavy traffic, is there a possibility that the templates dir gets out of whack and mobile users are being pointed to the desktop version. And worse Django is looking for templates in the mobile_dir for desktop users / vice versa and certain templates may not exist in either directory and throws 500 errors. Is that even possible?
(03 Jun '11, 13:41)
esatterwhite
That seems very unlikely, even impossible, to me.
(03 Jun '11, 14:54)
seanf
|
Hi Dave, There is nothing in your configuration that looks glaringly wrong, however, most of the Django mobile setups I have seen use a middleware that looks at the browser agent and grabs the templates or directs the browser to the right templates. answered 05 Nov '10, 01:16 klynton but doesn't that mess up template inheritance? Meaning, you'd have to have a ton of complicated if checks to display template blocks based on the browser agent? So then everything would have to be in templates and you couldn't have a separate mobile directory? Or am I being over simplified? With this method I can have a mobile dir be the "templates" dir and then all templates could inherit from that dir, creating a completely isolated template branch. Yes, I do have to do some copy and pasting, but it's not too painful and helps keep things clean. Thoughts?
(05 Nov '10, 01:53)
davemerwin
Hi, I'm not quite sure how the middleware handles inheritance. From what I've seen of middlewares that do this is that they have an entirely different set of templates, that are simpler and don't have as much information in them. It looks like you've got a good solution, as well. For the solution to your settings problem, there is some good information here: http://forum.webfaction.com/viewtopic.php?id=3646 On running multiple django apps with different WSGI files from the same apache.
(05 Nov '10, 02:14)
klynton
|
Just for the record. I have abandoned this method in favor of http://www.stacklayout.com/ answered 03 Jun '11, 15:10 lamusoftware |
I'm going to build a mobile version of my website on webfaction, is there any Middleware help me do that except minidetector? Take a look: https://truyenyy.com/truyen/de-ba/ answered 14 Aug '13, 23:49 toibadao The answer above my lamusoftware might be just what you need, you should try that, or stacklayout which they have recommended since.
(15 Aug '13, 01:30)
waynek
|