惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
量子位
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Y
Y Combinator Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
B
Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
博客园 - 聂微东
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks

Django

请教下 哪款 vscode 插件可以通过点击跳转 urls 定义 Django 一文告诉你 all 懒加载的机制 大家学习编程做项目的时候一开始会容易卡壳吗?比如我今天一个下午才弄出来了博客当中的文章评论加回复功能,有时候会因为一个小点卡壳,稍微复杂点的逻辑就感觉脑子不够用,甚至是给 html 的 div 取变量名的时候脑子也会不够 请教在 ubuntu23 中如何 让 Django runserver 开机自启动 不知道开发的流媒体合租平台有没有意义… 公司自主招聘(远程)后端 Go 开发,想要远程岗位抓紧啦 [求助] Mediacms 接入 Keycloak 有没有好的 drf 项目可以学习下的? django 快速开发明明 drf 更好,为啥还是很多人更推荐 fast.api 和忍者 django 的同步机制有性能瓶颈为什么还是有很多人用? 大家怎么处理开发时 Migration 一大堆,修修改改啰啰嗦嗦,同步到生产之前还得检查合并下这个问题的? Django 模型自定义 Manager 自定义 filter 如何支持链式调用? python3 manage.py build_index 这条 Django 命令到底啥意思啊?官方文档找不到说明,谢谢 前后端分离项目, Django 良好的项目结构是怎么样的 Django get_max_test_processes Django makemigrations 生成的 migrations 文件,如何放在代码当前目录的文件夹中? 请教下大家,Django 的 tests 测试模块,如何不创建新从测试数据库,而是直接操作生产环境数据库谢谢! django 好像对于 ios 打不开 admin page Django 模板中变量的嵌套 早起把网站的友链网页和自主添加友链功能撸出来了,过来收集一波友链 用 django 调用长时间执行的脚本,如何返还输出呢? Django 中递归分类 model 用什么组件显示比较合适? django 一开始没用 restfulapi 开发, 还能自动生成文档吗? 求推 django 数据可视化插件 django 用 docker 部署,要不要每次部署到服务器的时候改改 image 的 settings 配置 有没有使用 django 国际化模块的,针对 django.po 国际化文件写了一个 vscode 的插件 Django 访问 relation 时,如何得知是谁访问的? django admin 部分自带的 css 文件 collectstatic,生成的文件大小为 0? Django 怎么做同一个 url,对应不同的 view 函数? 请教 drf 全局封装 response 的优雅实现
请教 Django runserver 开机自启动的问题
hwhtj · 2024-07-23 · via Django

/etc/systemd/system/rc-local.service 文件内容:

 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target

/etc/rc.local 文件内容

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo "看到这行字,说明添加自启动脚本成功。" > /home/some/Qexo/test.log
a=`lsof -i:8000 | wc -l`
if [ "$a" -eq "0" ];then
       echo "start nohup django:8000" >> /home/some/Qexo/test.log
             nohup  /usr/bin/python3 /home/some/Qexo/manage.py runserver 0.0.0.0:8000 > cmdb.log 2>&1 &
       else
       echo "8000 端口被占用" >> /home/some/Qexo/test.log
fi
#source/home/some/Qexo/
#nohup /usr/bin/python3 /home/some/Qexo/manage.py runserver 0.0.0.0:8000 > cmdb.log 2>&1 &
echo "看到这行字,说明 django.sh 执行过。" >> /home/some/Qexo/test.log
exit 0

重启后,sudo systemctl status rc-local,报如下错误

 rc-local.service - /etc/rc.local Compatibility
    Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; preset: enabled)
   Drop-In: /usr/lib/systemd/system/rc-local.service.d
            └─debian.conf
    Active: failed (Result: exit-code) since Tue 2024-07-23 09:22:23 CST; 15min ago
  Duration: 236ms
   Process: 3617 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
  Main PID: 3621 (code=exited, status=1/FAILURE)
       CPU: 344ms

7 月 23 09:22:23 some-Ubuntu23 systemd[1]: Starting rc-local.service - /etc/rc.local Compatibility...
7 月 23 09:22:23 some-Ubuntu23 systemd[1]: Started rc-local.service - /etc/rc.local Compatibility.
7 月 23 09:22:23 some-Ubuntu23 systemd[1]: rc-local.service: Main process exited, code=exited, status=1/FAILURE
7 月 23 09:22:23 some-Ubuntu23 systemd[1]: rc-local.service: Failed with result 'exit-code'.