Using INI files

.INI files are a standard de-facto configuration way used by a lot of applications.

The syntax is very simple:


key1 = value1
key2 = value2


key1 = value1
key2 = value2

Starting from version 0.9.6 you can configure uWSGI via INI files. The same rules of XML are followed, so for every command line long-option there is a configuration key.



socket = /tmp/uwsgi.sock
processes = 4
master = true
module = myapp
harakiri = 30

this is the same as running:

./uwsgi --socket /tmp/uwsgi.sock --processes 4 --master --module myapp --harakiri 30

To use INI files simply pass the --ini option to the uWSGI command line:

./uwsgi --ini myconf.ini

By default the uwsgi section is used but you can specify other section name in this way:

./uwsgi --ini myconf.ini:app1
./uwsgi --ini myconf.ini:app2

and in the myconf.ini:

socket = /tmp/uwsgi1.sock
processes = 4
master = true
module = myapp1
harakiri = 30

socket = /tmp/uwsgi2.sock
processes = 4
master = true
module = myapp2
harakiri = 30

A real world example, Pylons deployment

first setup a pylons virtualenv

virtualenv PYLO

PYLO/bin/easy_install pylons

then create your first (hello world) project (leave default values)

PYLO/bin/paster create -t pylons helloworld

In the helloworld directory you will find the development.ini file. We can use this file to add uWSGI configuration section:

(add the following lines to development.ini, substitute <absolute_project_path> with the full path of the helloworld app)


socket = :3031
master = true
# this is the path to the virtualenv
home = PYLO
# this will point to the same file
paste = config:<absolute_project_path>/development.ini

Now run:

./uwsgi --ini helloworld/development.ini

Hey, do you like the paste configuration directive ? Why being redundant ?

Starting from 0.9.6-rc2 release you can use the --ini-paste commodity.

Simply use --ini-paste instead of --ini and do not specify the paste directory.

uWSGI will automatically parse the ini file with paste.deploy


As xml and yaml, ini files can use reference

foo = www
domain =
chdir = /var/%(foo)
socket = /tmp/%(domain).sock


Ini files can be downloaded and parsed via http

uwsgi --ini


You can specify no-argument-required options without INI value:

processes = 4
socket =

But this will not work with paste.deploy !!!

Comments are supported with ; and #

; i am a comment
# i am a comment too

The .ini extension is recognized as a magic arg, so you can launch uwsgi with

uwsgi file.ini

without specifying the --ini arg