Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

484
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda