Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django-collectstatic&x27;配置不当';部署到Heroku时的回溯_Python_Django_Heroku_Collectstatic - Fatal编程技术网

Python Django-collectstatic&x27;配置不当';部署到Heroku时的回溯

Python Django-collectstatic&x27;配置不当';部署到Heroku时的回溯,python,django,heroku,collectstatic,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': i

我正在学习使用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的新手,非常感谢您的帮助。

为什么您的设置文件中有那个奇怪的守卫?你不需要任何类似的东西。扩展@DanielRoseman注释,查看Heroku的Django初学者模板,作为配置项目@AlanAvalos的推荐方法。谢谢,我会检查的。为什么你的设置文件中有那个奇怪的守卫?你不需要任何类似的东西。扩展@DanielRoseman注释,查看Heroku的Django初学者模板,作为配置项目@AlanAvalos的推荐方法谢谢,我会查看的。