- 汇总学习目录、博客分类与最近更新的 10 篇文章 - 调用本地 Ollama qwen3.8:27b 生成技术栈与最近在做 - 每次生成入库,10 天后首次打开首页自动重新生成 - 前端逐字展开缓存摘要,过期时读取 AI 流式响应 - 首页在开场引导结束后显示;拾脉目录页内嵌展示 - 修复摘要面板标题栏命中全局 header 定位的问题
52 lines
1.7 KiB
Python
52 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('digest/', include('digest.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 # 实际文件路径
|
|
) |