django-静态资源
可以利用
sphinx
生成文档,通过django
部署
安装必要组件
pip install django
# 创建django项目
django-admin startproject mysite .
配置
就是将 url
和 资源目录对应。
├── docs
│ ├── build
│ │ ├── html
│ │ │ └──index.html
│ │ └── doctrees
│ ├── make.bat
│ ├── Makefile
│ └── source
│ ├── conf.py
│ ├── index.rst
│ ├── _static
│ └── _templates
├── mysite
│ ├── asgi.py
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── db.sqlite3
└── manage.py
# mysite/settings.py
# 静态资源
STATIC_URL = '/docs/' # url
STATIC_ROOT = BASE_DIR / 'docs/build/html' # 资源目录
# mysite/urls.py
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
# 加入docs目录
] + static(settings.STATIC_URL , document_root=settings.STATIC_ROOT)
访问
http://127.0.0.1:8000/docs/index.html
标签:settings,python,docs,py,django,静态,static,urls
From: https://www.cnblogs.com/SHUN-ReRound/p/18678485