How to Set Environment Variables with uwsgi

You can add env declarations in your uwsgi ini files as follows:


# Django-related settings
# the base directory (full path)
chdir           = /project/path
# Django's wsgi file
module          = project.wsgi
# the virtualenv (full path)
home            = /home/someuser/.virtualenvs/project

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = /project/path/nhs.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 664
# clear environment on exit
vacuum          = true

env             = DJANGO_CONFIGURATION=SomeConfig

You can add multiple env declarations if you want to declare several parameters


One thought on “How to Set Environment Variables with uwsgi”

Leave a Reply

Your email address will not be published. Required fields are marked *