无法执行静电消除 [英] Unable to perform collectstatic
本文介绍了无法执行静电消除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是django的新手!当我使用命令 python manage.py collectstatic
时遇到此错误
I am new to django ! When I use the command python manage.py collectstatic
I get this error
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path
但是我可以成功运行服务器。
But I can successfully run the server .
我的静态文件声明是:
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
('assets', os.path.join(PROJECT_DIR, '../static')),
)
并将调试设置为true
and debug is set to true
DEBUG = True
我该如何解决?其他缺少的安装包吗?
How can I fix this? Else am missing any installation packages ?
推荐答案
尝试一下,
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
查看 https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATIC_ROOT
这篇关于无法执行静电消除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文