本文介绍了python manage.py collecstatic不会复制我的.css文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用django中的静态文件。
我看过很多视频,我知道我觉得我做的正确。
以下是 settings.py 片段:
STATIC_URL ='/ static /' STATICFILES_DIR =(os.path.join(BASE_DIR,'static')) STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR),'static_cdn')我还将其添加到 urls.py :
if settings.DEBUG: urlpatterns + = static(settings.STATIC_URL,document_root = settings.STATIC_ROOT)当我执行收藏,它会复制所有来自admin文件夹的文件。但是它不是从静态文件夹复制我的 .css 文件。有人可以告诉我我在哪里做错了。
解决方案设置是 STATICFILES_DIRS ,带有S,因为它是一个列表的目录。
STATICFILES_DIRs =(os.path.join(BASE_DIR,'static'),)
I am trying to work with static files in django.
I have watched many videos and I know I feel I am doing it correctly.
Following is the settings.py snippet:
STATIC_URL = '/static/' STATICFILES_DIR = (os.path.join(BASE_DIR, 'static'),) STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static_cdn')I have also added this to urls.py:
if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)When I do a collectstatic it copies all those from admin folder. But it is not copying my .css file from static folder. Can someone tell me where am I doing it wrong.
解决方案The setting is STATICFILES_DIRS, with an S, as it's a list of directories.
STATICFILES_DIRs = (os.path.join(BASE_DIR, 'static'),)
更多推荐
python manage.py collecstatic不会复制我的.css文件
发布评论