About the management of the uwsgi server
Foreword It's great to use Django for project development, but the deployment is too troublesome. With the Uwsgi server, every time you modify the code, you need to restart the server for the changes to take effect. Restarting the uwsgi server is also quite cumbersome. After looking at the official documentation, it's best to install uwsgi into the venv virtual environment so that it's easy to distinguish when running `ps aux`. Checking uwsgi processes `ps -aux | grep uwsgi` Terminating the original uwsgi process `kill -9 27543` Conclusion
目录6 个章节
Preface
Using Django to develop projects is great, but deployment is quite troublesome. When using the Uwsgi server, every time the code is modified, the server needs to be restarted for the changes to take effect. Moreover, restarting the Uwsgi server is also quite a hassle.
After reviewing the official documentation, it's best to install Uwsgi inside a venv virtual environment. This way, it's easier to differentiate when running
ps aux.
View uwsgi processes
ps -aux | grep uwsgi

Terminate the original uwsgi process
kill -9 27543
Conclusion
This is still cumbersome—you have to manually locate the uwsgi process and terminate it. Next, I should look for a more convenient approach, such as adding uwsgi as a service for systemctl to manage, though the official documentation advises against doing this?
Supplementary
There are a few other ways to simplify the management of the uwsgi server.
- Using Supervisor to manage the uwsgi service
Supervisor (http://supervisord.org/) is a client/server service developed in Python. It's a process management tool for Linux/Unix systems and does not support Windows. It can conveniently monitor, start, stop, and restart one or multiple processes. When a process managed by Supervisor is unexpectedly killed, the supervisor detects the process death and automatically restarts it, providing a convenient automatic process recovery feature without needing to write shell scripts yourself.
References:
-
Emperor mode
uWSGI can run in 'emperor' mode. In this mode, it monitors a directory of uWSGI configuration files and generates an instance ('vassal') for each configuration file it finds. Whenever a configuration file is modified, the emperor will automatically restart the vassal.
Reference: http://uwsgi-docs-zh.readthedocs.io/zh_CN/latest/tutorials/Django_and_nginx.html
Following international convention, a picture is placed at the end of the article as a cover.

About

For more interesting tips, follow my WeChat public account: DealiAxy All articles are also available on my blog: blog.deali.cn
_EOF_
About the management of the uwsgi server
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
Django过时了吗?从ASGI到AI时代的思考
Django过时?技术趋势变了而已,异步支持短板在AI时代更明显。生态工程化再稳,也挡不住轻量框架和ASGI的冲击。独立开发者该考虑新选择了?
2025-09-12 · Django · 约 1 分钟
Django的信号机制入门
概念 django自带一套信号机制来帮助我们在框架的不同位置之间传递信息。也就是说,当某一事件发生时,信号系统可以允许一个或多个发送者(senders)将通知或信号(signals)发送给一组接受者(receivers)。 (感觉就很像Qt的信号与槽机制) 信号系统包含以下三要素: 发送者-信号的发出方 信号-信号本身 接收者-信号的接受者 Django内置了一整套信号,下面是一些比较常用的: 在
2022-08-26 · Django · 约 1 分钟
如何优雅地在Django项目里生成不重复的ID?
在生成唯一 ID 这件事上,Django 和其他后端框架没啥不同的,思路都是类似的,只不过可以借助 Python 生态偷懒一下…
2024-12-08 · Django · 约 1 分钟
Django数据库性能优化之使用Python集合操作
前言 最近有个新需求: 人员基础信息(记作人员A),10w 某种类型的人员信息(记作人员B),1000 要求在后台上(Django Admin)分别展示:已录入A的人员B列表、未录入的人员B列表 团队的DBA提议使用视图可以解决这个问题(不愧是搞数据库的) PS:起先我觉得Django的Model是直接管理数据库表的,使用Model来映射数据库模型怕是有一定的麻烦,不过查了一下资料发现并不会~ 只
2022-08-26 · Django · 约 1 分钟
讨论
共 0 条加载评论中…