Use the documentation, Luke! ;)

http://uwsgi-docs.readthedocs.org/en/latest/PythonModule.html#uwsgi.opt

And to prove it works:

# x.ini --
[uwsgi]
xxtest=foo
xxbaz=quux
socket=:3030
wsgi-file=test-opt.py

# test-opt.py --
import uwsgi, pprint
pprint.pprint(uwsgi.opt)
application = lambda a, e: None

# Output of “bin/uwsgi x.ini” --
{'socket': ':3030',
'wsgi-file': 'test-opt.py',
'xxbaz': 'quux',
'xxtest': 'foo'}

From: [email protected] [mailto:[email protected]] On 
Behalf Of C Anthony Risinger
Sent: Tuesday, May 21, 2013 6:59 AM
To: uWSGI developers and users list
Subject: Re: [uWSGI] Access to the config options at the global scope in uWSGI 
app

On Mon, May 20, 2013 at 1:26 PM, dracek mracek 
<[email protected]<mailto:[email protected]>> wrote:
Hello,

I would like to ask if it's possible to access to config values defined in 
application config (ie .ini). I want mysql db connection was specified in the 
config but didn't find how to access to them in Python (using uWSGI 1.9.10, 
Debian)

So far I've gone through dozens of values but nothing seems to fit 
configuration.
import uwsgi
len(uwsgi)

you can use `--get` for external access, but within python you can access from 
the `uwsgi` module... i forget the exact attr off the top of my head, but try:

>>> import uwsgi
>>> help(uwsgi)

...instead of `len` and methinks it will all pan out from there ;)

--

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

Reply via email to