Supervisor supports Python virtual environments venv

Source: Internet
Author: User
Tags virtual environment

When using supervisor in a project, there are small problems with how to start in a virtual environment.

Tried the sh script, activating the virtual environment in the script, so that although it can start normally, supervisor cannot end the process correctly and must end manually.

After repeated groping, found that it is easy to achieve, slightly modified under the Supervisor configuration can be.

Suppose that our virtual environment is in the venv of the project root directory.

Then in the configuration of the supervisor to make the following changes, do not need to modify the place omitted.

Directory=/home/pepper/code/jadetower_health above this point to the root directory of the project Command=venv/bin/python gunicorn-w 6-b 0.0.0.0:8001 Project.wsgi--access-logfile logs/gunicorn.log Command launch commands do not use Python directly, but instead use Python in the virtual environment, this is Venv/bin/python.  Finally, following the script that needs to be started, I'm using the Gunicron. Finally, update the supervisor configuration SupervisorctlUpdate and then restartSupervisorctl ReloadAt this point the project is already running in a virtual environment.

Supervisor supports Python virtual environments venv

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.