- 新增 studio 应用与 /manage/ 写作台 - 文章增删改查、状态/分类/标签、搜索筛选分页 - 分类增删改查,支持父分类 - 直接上传 .md(front matter)并创建文章,编辑页支持 Markdown 导入 - Post 增加 content_format,公开文章页支持 Markdown 渲染 - 复用拾匣密码解锁;首页页脚新增写作台入口
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""
|
|
URL configuration for blogsite project.
|
|
|
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
|
Examples:
|
|
Function views
|
|
1. Add an import: from my_app import views
|
|
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
Class-based views
|
|
1. Add an import: from other_app.views import Home
|
|
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
Including another URLconf
|
|
1. Import the include() function: from django.urls import include, path
|
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
"""
|
|
|
|
"""
|
|
项目根路由
|
|
所有请求先到这里,再分发到各个 app 的 urls.py
|
|
"""
|
|
|
|
from django.contrib import admin
|
|
from django.urls import path, include
|
|
from django.conf import settings
|
|
from django.conf.urls.static import static
|
|
|
|
|
|
urlpatterns = [
|
|
# 管理后台
|
|
path('admin/', admin.site.urls),
|
|
|
|
# 博客 app 的所有路由
|
|
# 空字符串表示挂载到根路径
|
|
# 比如 blog/urls.py 里定义了 '' → 实际访问 /
|
|
path('files/', include('cabinet.urls')),
|
|
path('reflections/', include('reflections.urls')),
|
|
path('moments/', include('moments.urls')),
|
|
path('manage/', include('studio.urls')),
|
|
path('', include('blog.urls')),
|
|
path("mindmaps/", include("mindmaps.urls")),
|
|
path("api/",include("api.urls")),
|
|
]
|
|
|
|
# 开发环境下,让 Django 提供 media 文件的访问
|
|
# 生产环境应该用 Nginx/Apache 直接提供静态文件
|
|
if settings.DEBUG:
|
|
urlpatterns += static(
|
|
settings.MEDIA_URL, # URL 前缀 /media/
|
|
document_root=settings.MEDIA_ROOT # 实际文件路径
|
|
) |