feat: 配置文件

This commit is contained in:
Czw996 2021-12-25 22:00:14 +08:00
parent da3bc2319c
commit bddee4ee48
4 changed files with 3 additions and 23 deletions

View file

@ -4,3 +4,4 @@ import multiprocessing
bind = '0.0.0.0:8000'
workers = multiprocessing.cpu_count() * 2 + 1
reload = True
daemon = True

View file

@ -1,5 +0,0 @@
[program:django]
command=gunicorn project.asgi:application -c configs/gunicorn.py -k uvicorn.workers.UvicornWorker
directory=/home/oms
autostart=true
autorestart=true

View file

@ -26,8 +26,5 @@ python manage.py runscript create_user
python manage.py runscript create_test_data
python manage.py runserver
gunicorn project.asgi:application -c configs/gunicorn.py -k uvicorn.workers.UvicornWorker
supervisord -c configs/supervisor.conf
supervisorctl status
supervisorctl [start/stop/restart] django
supervisorctl reload
ps -aux | grep gunicorn | awk '{print $2}'| xargs kill -9
```

View file

@ -7,7 +7,6 @@ def run():
create_nginx_config()
create_django_config()
create_gunicorn_config()
create_supervisor_config()
def create_nginx_config():
@ -121,19 +120,7 @@ import multiprocessing
bind = '{bind_address}'
workers = multiprocessing.cpu_count() * 2 + 1
reload = True
""")
def create_supervisor_config():
is_need_create = input('是否需要创建 Supervisor 配置文件吗? (y/n)\n')
if is_need_create == 'y':
with open('configs/supervisor.conf', 'w') as file:
file.write(f"""\
[program:django]
command=gunicorn project.asgi:application -c f{BASE_DIR}/configs/gunicorn.py -k uvicorn.workers.UvicornWorker
directory=f{BASE_DIR}
autostart=true
autorestart=true
daemon = True
""")