You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path

前端 未结 3 1409
感情败类
感情败类 2021-01-12 16:51

I have gone through every other answer and cannot seem to get anything to work for me. I am following a tutorial and trying to push my master branch to heroku a

3条回答
  •  悲&欢浪女
    2021-01-12 17:41

    I was able to make this work by getting rid of the if statement all together and just having the following in my settings.py.

    import dj_database_url
    DATABASES = {
        'default': dj_database_url.config(default='postgres://localhost')
    }
    
    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
    
    ALLOWED_HOSTS = ['*']
    
    BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (
        os.path.join(BASE_DIR, 'static'),
    )
    

提交回复
热议问题