Django - collectstatic' NotperlyConfigured'部署到Heroku

时间:2017-02-10 01:38:44

标签: python django heroku collectstatic

我正在学习使用Django并尝试在Heroku上部署项目。当我尝试通过命令窗口部署项目时,我在运行python manage.py collectstatic

时获得以下回溯
Improperly Configured: You're using the staticfiles app without having set
the STATIC_ROOT setting to a filesystem path.

我对heroku的设置是:

if os.getcwd() == '/app':
    import dj_database_url
    DATABASES = {
        'default': dj_database_url.config(default='postgres://localhost')
    }

    SECURE_PROXY_SSL_HEADER  = ('HTTP_X_FORWARDED_PROTO', 'https')

    ALLOWED_HOSTS = [*]

    # Static set configuration 
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    STATIC_ROOT = 'staticfiles'
    STATICFILES_DIR = (
        os.path.join(BASE_DIR, 'static'),
    )

我是django的新手,感谢您的帮助,谢谢。

0 个答案:

没有答案