Django 学习笔记

2019-04-25  本文已影响0人  Fonzie

Django 处理静态文件

STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
from django.urls import path
from . import views
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('', views.index, name='index'),
    path('deploy/', views.deploy_record, name='deploy_record'),
    path('api/build/', views.deploy_save_as, name='api_build'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
python manage.py collectstatic 
上一篇下一篇

猜你喜欢

热点阅读