diff --git a/MrDoc/settings.py b/MrDoc/settings.py index 29689ec..a2be04a 100644 --- a/MrDoc/settings.py +++ b/MrDoc/settings.py @@ -23,7 +23,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False ALLOWED_HOSTS = ['*'] @@ -122,11 +122,13 @@ USE_TZ = True # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' -STATICFILES_DIRS = [os.path.join(BASE_DIR,'static'),] +if DEBUG: + STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'), ] +else: + STATIC_ROOT = os.path.join(BASE_DIR,'static') # 媒体文件 MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR,'media') -# 日志配置 diff --git a/MrDoc/urls.py b/MrDoc/urls.py index 40ec3a3..8f5ede4 100644 --- a/MrDoc/urls.py +++ b/MrDoc/urls.py @@ -22,5 +22,6 @@ urlpatterns = [ path('admin/', admin.site.urls), path('',include('app_doc.urls')), path('user/',include('app_admin.urls'),), + re_path('^static/(?P.*)$',serve,{'document_root':settings.STATIC_ROOT}),# 静态文件 re_path('^media/(?P.*)$',serve,{'document_root':settings.MEDIA_ROOT}),# 媒体文件 ] diff --git a/template/404.html b/template/404.html index eddceb8..2985f02 100644 --- a/template/404.html +++ b/template/404.html @@ -44,8 +44,11 @@
-
- +
+

+ 页面未找到…… +

+

返回首页