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

推荐订阅源

K
Kaspersky official blog
罗磊的独立博客
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
量子位
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
M
MIT News - Artificial intelligence
B
Blog RSS Feed
腾讯CDC
博客园_首页
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
博客园 - Franky
S
SegmentFault 最新的问题
N
Netflix TechBlog - Medium
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LINUX DO - 热门话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
D
Docker
P
Privacy & Cybersecurity Law Blog
S
Securelist
V
V2EX
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
T
Tor Project blog
The Hacker News
The Hacker News
Microsoft Azure Blog
Microsoft Azure Blog
AWS News Blog
AWS News Blog
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
T
The Exploit Database - CXSecurity.com
Help Net Security
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
Recent Announcements
Recent Announcements
Cloudbric
Cloudbric
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
V2EX - 技术
V2EX - 技术

Django

请教下 哪款 vscode 插件可以通过点击跳转 urls 定义 - V2EX Django 一文告诉你 all 懒加载的机制 - V2EX 大家学习编程做项目的时候一开始会容易卡壳吗?比如我今天一个下午才弄出来了博客当中的文章评论加回复功能,有时候会因为一个小点卡壳,稍微复杂点的逻辑就感觉脑子不够用,甚至是给 html 的 div 取变量名的时候脑子也会不够 - V2EX 请教在 ubuntu23 中如何 让 Django runserver 开机自启动 - V2EX 不知道开发的流媒体合租平台有没有意义… - V2EX 公司自主招聘(远程)后端 Go 开发,想要远程岗位抓紧啦 - V2EX [求助] Mediacms 接入 Keycloak - V2EX 有没有好的 drf 项目可以学习下的? - V2EX django 快速开发明明 drf 更好,为啥还是很多人更推荐 fast.api 和忍者 - V2EX django 的同步机制有性能瓶颈为什么还是有很多人用? - V2EX 大家怎么处理开发时 Migration 一大堆,修修改改啰啰嗦嗦,同步到生产之前还得检查合并下这个问题的? - V2EX Django 模型自定义 Manager 自定义 filter 如何支持链式调用? - V2EX python3 manage.py build_index 这条 Django 命令到底啥意思啊?官方文档找不到说明,谢谢 - V2EX 前后端分离项目, Django 良好的项目结构是怎么样的 - V2EX Django get_max_test_processes - V2EX Django makemigrations 生成的 migrations 文件,如何放在代码当前目录的文件夹中? - V2EX 请教下大家,Django 的 tests 测试模块,如何不创建新从测试数据库,而是直接操作生产环境数据库谢谢! - V2EX django 好像对于 ios 打不开 admin page - V2EX Django 模板中变量的嵌套 - V2EX 早起把网站的友链网页和自主添加友链功能撸出来了,过来收集一波友链 - V2EX 用 django 调用长时间执行的脚本,如何返还输出呢? - V2EX Django 中递归分类 model 用什么组件显示比较合适? - V2EX django 一开始没用 restfulapi 开发, 还能自动生成文档吗? - V2EX 求推 django 数据可视化插件 - V2EX django 用 docker 部署,要不要每次部署到服务器的时候改改 image 的 settings 配置 - V2EX 有没有使用 django 国际化模块的,针对 django.po 国际化文件写了一个 vscode 的插件 - V2EX Django 访问 relation 时,如何得知是谁访问的? - V2EX django admin 部分自带的 css 文件 collectstatic,生成的文件大小为 0? - V2EX Django 怎么做同一个 url,对应不同的 view 函数? - V2EX 请教 drf 全局封装 response 的优雅实现 - V2EX django 里面的原生的 sql 查询,会一直占用数据库连接吗 - V2EX Django ORM 如何才能在 save_model 插入数据库完成后,再次更新数据库? - V2EX django 定时触发任务 - V2EX 请问 django 怎么高效的获取范围内一条随机数据 - V2EX 请问 Django ORM 如何实现 left join? - V2EX [求助] Django 图片路径的问题 - V2EX 为什么 django ORM 的更新时间字段选择在程序内部生成(auto_now),而不使用 MYSQL 的 on update? - V2EX 有基于 django 的开源博客系统吗? - V2EX Django admin 当中动态显示外键的相关属性 - V2EX Django 如何获取 apscheduler 的 scheduler 实例? - V2EX django3 的 i18n 汉化求救 - V2EX 你们公司的 django 项目如何 - V2EX Django 的 ORM 的 exclude 和 filter 的区别到底是啥? - V2EX 关于如何根据 Accept 的 media_type 返回不同类型序列化数据的想法 - V2EX 请问 Django 在启动的时,如何执行一次性业务代码? - V2EX 推荐一本 django 源码解析的书《深入理解 Django 框架内幕与实现原理》 - V2EX 请问 Django 的 JSONField 字段有没有必要进行索引? - V2EX 分享一个在 Django 的 model 里,使用元类动态添加相似的带自定义中间表的多对多关系字段的方法 - V2EX 咨询个 django 处理耗时任务的问题,顺便找个兼职完成个 demo - V2EX
请教 Django runserver 开机自启动的问题 - V2EX
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'.