无法执行collectstatic

我是django的新手! 当我使用命令python manage.py collectstatic我得到这个错误

 django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path 

但是我可以成功运行服务器。

我的静态文件声明是:

 STATIC_ROOT = '' STATIC_URL = '/static/' STATICFILES_DIRS = ( ('assets', os.path.join(PROJECT_DIR, '../static')), ) 

并将debug设置为true

 DEBUG = True 

我怎样才能解决这个问题? 否则我缺less任何安装包?

尝试这个,

 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

您必须在settings.py中的STATIC_ROOT中提供所有静态文件的收集path,例如: –

 STATIC_ROOT = "app-root/repo/wsgi/static" STATIC_URL = '/static/' STATICFILES_DIRS = ( ('assets', 'app-root/repo/wsgi/openshift/static'), )