Django 开发服务器

复制代码
$ python manage.py runserver
$ python manage.py runserver 666            # 用 666 端口
$ python manage.py runserver 0.0.0.0:8000   # 让局域网内其他客户端也可访问
$ python manage.py runserver --skip-checks  # 跳过检查自动检查
$ python manage.py runserver --noreload     # 禁用自动重载
$ python manage.py runserver --nothreading  # 用单线程运行,默认多线程
$ python manage.py runserver -6             # 在 IPv6 地址 ::1: 上运行 8000 端口
$ python manage.py runserver -6 7000        # 在 IPv6 地址 ::1: 上运行 7000 端口

# 在自定义 IPv6 地址上运行 7000 端口
$ python manage.py runserver -6 [2001:0db8:1234:5678::9]:7000
  • 服务器类型:WSGI
  • 默认多线程,也可用单线程启动
  • 可运行多个
  • 每个请求都会重新加载代码,无需重启服务,如果有项目 文件变动,则需手动重启
  • 类 Unix 系统若装有 Watchman 服务,则内核信号机制会被用于自动重启服务,
  • 不负责处理静态文件访问
  • ⚠️该轻量级服务器仅供开发调试使用,未经过完善的安全优化、性能测试

Django 5.2 新增:

DJANGO_RUNSERVER_HIDE_WARNING

设为 True可隐藏提示 WARNING: This is a development server....

相关推荐
风之所往_6 小时前
Python 3.0 新特性全面总结
python
2401_882273726 小时前
如何在 CSS 中正确加载本地 JPG 背景图片
jvm·数据库·python
Lucas_coding6 小时前
【Claude Code Router】 Claude Code 兼容 OpenAI 格式 API, Claude code 接入本地部署模型
人工智能·python
测试员周周7 小时前
【AI测试系统】第5篇:从 Archon 看 AI 工程化落地:为什么"确定性编排+AI 弹性智能"是终局?
人工智能·python·测试
大飞记Python7 小时前
【2026更新】Python基础学习指南(AI版)——04数据类型
开发语言·人工智能·python
Hello eveybody8 小时前
介绍一下背包DP(Python)
开发语言·python·动态规划·dp·背包dp
2301_795099749 小时前
让 CSS Grid 自适应容器尺寸的动态布局方案
jvm·数据库·python
呆萌的代Ma9 小时前
python读取并加载.env的配置文件
python
Muyuan19989 小时前
27.RAG 系统中的上下文充分性判断:从 Chunk 数量、FAISS 距离到 LLM Relevance Gate
python·django·pdf·fastapi·faiss
U盘失踪了9 小时前
python curl转python脚本
开发语言·chrome·python