标签:cti 文件 com linu direct 操作 后台运行 home auto
反向生成models:
python manage.py inspectdb > 路径/models.py
依赖文件生成
pip freeze > requirements.txt
取到models所有字段:
field = models.XXX.objects.first()._meta.fields
for i in field:
print(i.name)
日志标简易配置:
logging.basicConfig(level=logging.ERROR,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt=' %Y-%m-%d %H:%M:%S',
filename='bug.log', filemode='a',
)
查看可用端口:
sudo service iptables status
已在运行的端口:
ps -ef|grep python
杀死所有9011端口相关的tcp进程
fuser -k 9011/tcp
一般后台运行
nohup python manage.py runserver 0.0.0.0:9011 &
1 编写配置文件
vim /etc/supervisor/conf.d/xxxx.ini
2 参考配置文件
用uwsgi运行
[program: inventory]
directory=/home/ywc/inventory
command= /home/ywc/pycharm/ye_test/bin/python3.6 /home/ywc/inventory/manage.py runserver 0.0.0.0:9013
numprocs=1
numprocs_start=1
autostart=true
autorestart=true
process_name=%(program_name)s
直接运行
[program: talk_django2.0-master]
directory=/home/mbox/python_project/Talk_django2.0-master
command= /home/mbox/python_project/Talk_django2.0-master/py3env/bin/uwsgi --ini /home/mbox/python_project/Talk_django2.0-master/uwsgi.ini
numprocs=1
numprocs_start=1
autostart=true
autorestart=true
process_name=%(program_name)s
3 重新加载配置
supervisorctl reload
标签:cti 文件 com linu direct 操作 后台运行 home auto
原文地址:https://www.cnblogs.com/qq752059037/p/10792192.html