Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

487
Vistas
Export DJANGO_SETTINGS_MODULE as environment variable in supervisor

My project is based on Django, Nginx, Gunicorn and Supervisor in a Virtual env.

I export environmental variables at the end of the ./bin/activate script. Whenever I source the activate file, it exports environmental variables. It's pretty cool...

My issue comes when I start the Supervisor script. It seems that the ./bin/activate isn't sourced as Django can't get vars such as SECRET_KEY.

I heard people using a post-activate script which isn't present in my virtualenv bin dir. Am I missing something important? Why Supervisor doesn't source the ./bin/activate script?

Here is my supervisor conf:

command=/opt/.virtualenvs/plcweb/bin/gunicorn plcweb.config.wsgi -c /opt/plcweb/gunicorn.conf.py
directory=/opt/plcweb/project
user=bastien
autostart=true
autorestart=true
redirect_stderr=True
stdout_logfile=/opt/plcweb/gunicorn.log
stderr_logfile=/opt/plcweb/gunicorn.log
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

As explained here, you have a very simple solution with the environment directive. So to export DJANGO_SETTINGS_MODULE, supervisor conf file should be as following:

command=/opt/.virtualenvs/plcweb/bin/gunicorn plcweb.config.wsgi -c /opt/plcweb/gunicorn.conf.py
environment=DJANGO_SETTINGS_MODULE=my_project.settings.production
directory=/opt/plcweb/project
user=bastien
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda