2๐
โ
you cannot really do that as your environment is setup in ~/.bashrc locally which uwsgi does not have access to.
you might be able to get away with putting the variable in /etc/rc.local
but Im not even sure that will work
you can add them to your file
[uwsgi]
chdir = /home/ubuntu/my_app
module = my_app.wsgi
# path below is to virtual environment
home = /home/ubuntu/my_app/env
http = :8000
check-static = /var/www/my_app
daemonize = /var/log/uwsgi/my_app
# process-related settings
master = true
processes = 10
vacuum = true
#environment
env=SECRET_KEY="My Super Secret Key"
or you can configure it directly on the app object in your python file
app = Flask(__name__)
app.secret_key="My Super Secret Key"
which to be frank is probably the way I would do it
๐คJoran Beasley
0๐
inside your uwsgi ini config:
env = SECRETKEY=$(SECRETKEY)
^^^ this will instruct uwsgi to take the SECRETKEY env var and ensure it is set in the forked processes it creates
๐คnachonachoman
- [Answered ]-How to test for existance of a certain level in django messages
- [Answered ]-How to properly import django project settings to interact with app's ORM?
- [Answered ]-How do I test a Django model with ImageSpecField?
- [Answered ]-My api call doesnot work in javascript but works fine with in postman and browser
- [Answered ]-Django-concurrency is doing nothing
Source:stackexchange.com