0
通過的runserver發展試圖服務器staticfiles,Django的1.10的Django的runserver用DEBUG真服錯了靜態文件
我有'django.contrib.staticfiles'
我INSTALLED_APPS
,並根據相關設置:
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
"django.contrib.staticfiles.finders.FileSystemFinder",
)
STATICFILES_DIRS = [
path('node_modules'), # resolves to `node_modules/` in the project root
]
STATIC_URL = '/static/'
STATIC_ROOT = path('static') # resolves to `path/` in the project root
該作品罰款爲collectstatic,並直接通過NginX服務。然而,隨着的runserver + DEBUG=True
,我期待Django的web服務器從static/
文件夾服務,而是它是從node_modules/
文件夾服務。
如果我刪除/重命名node_modules/
然後我得到404s的靜態文件。
靜態文件通過複製(而不是symlink)進行收集。
我使用的Django渠道,可能會劫持一切以及?
賓果!謝謝。雖然'static()'自己返回一個列表,所以不需要將它封裝在'[]'中,以免發生':(urls.E004)你的URL模式[。*) $>]無效。確保urlpatterns是url()實例的列表 –
DanH