How to Set Environment Variables with uwsgi

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


[uwsgi]

# 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

Reference

https://coderwall.com/p/93jakg/multiple-env-vars-with-uwsgi

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

Leave a Reply to adazeng Cancel reply

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