[PYTHON] I couldn't daemonize gunicorn with Fabric

Background

I was making an app with Django and using fabric and cuisine to code the environment construction, but gunicorn doesn't daemonize well. If you remove the daemonization option, it will be executed, so I don't think it's because the settings are incorrect.

Commands that don't work

puts(green('Starting gunicorn process...'))
with cd(project_root_path):
    run('gunicorn {}.wsgi:application -c gunicorn_conf.py'.format(project_name))

solution

Just set pty = False. I haven't read the reason because it's troublesome.

run('gunicorn {}.wsgi:application -c gunicorn_conf.py'.format(project_name), pty=False)

reference

http://www.fabfile.org/faq.html#init-scripts-don-t-work You can see it by reading ʻInit scripts do n’t work!` Here. I haven't read it in detail, but it seems that something doesn't work.

In my case, starting and stopping nginx and td-agent worked, but gunicorn, which is not managed as a package, did not work.

For the time being, this completes the server environment construction and deployment with a single command.

Recommended Posts

I couldn't daemonize gunicorn with Fabric
I was in trouble because I couldn't push with heroku
I played with wordcloud!
Operate Gunicorn via Fabric
I tried fp-growth with python
I tried scraping with Python
I wrote GP with numpy
I tried Learning-to-Rank with Elasticsearch!
Fast file transfer with fabric
I implemented VQE with Blueqat
I can't search with # google-map. ..
I measured BMI with tkinter
I tried gRPC with Python
I made COVID19_simulator with JupyterLab
I tried scraping with python
I made Word2Vec with Pytorch
I made blackjack with Python.
I made wordcloud with Python.
Do multi-stage SSH with Fabric
I couldn't use tkinter with python installed by pyenv of anyenv
I tried standalone deployment of play with fabric [AWS operation with boto] [Play deployment]