Il giorno 01/ago/2012, alle ore 13:21, Charlie Orford ha scritto:

> On 01/08/2012 13:14, Damjan wrote:
>>> The reason I'm trying to set a couple of ENV vars in nginx and then pass 
>>> them through to Flask is due to internationalization. What I wanted to 
>>> achieve was a setup where I could register domain.com, domain.it, 
>>> domain.es, domain.de, domain.co.uk etc. and have all of these domains 
>>> hosted on the same nginx instance, pointing to the same Flask app. I 
>>> then wanted to pass through a language environment var based on which 
>>> nginx vhost a client used to access the site (so that Flask could then 
>>> serve the app in the correct language). 
>> 
>> You can modify the PATH_INFO or QUERY_STRING variables in nginx perhaps? 
>> 
> 
> Yep, I think I'll have to do something like that. There are many ways to do 
> it, it just felt like setting an env var was the cleanest :)
> 
> 

In my opinion the "right" approach is setting per-request variables:

uwsgi_param FOO_LANGUAGE 'italian'

Then you can access FOO_LANGUAGE in request.environ dictionary


--
Roberto De Ioris
http://unbit.it
JID: [email protected]

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to