Heroku server error (500) when Debug = False , whitenoise could not find style.css

前端 未结 5 1175
深忆病人
深忆病人 2020-12-20 06:13

I am getting a Server Error(500) when debug is set to false, But the site works fine when debug=True

This is the Heroku log: [EDIT:NEW LOG FILE AFTER MAKING

相关标签:
5条回答
  • 2020-12-20 06:41

    Try making migrations with:

    heroku run python manage.py makemigrations

    heroku run python manage.py migrate

    I had the same issue, but this solved it.

    0 讨论(0)
  • 2020-12-20 06:41

    While turning off Debugging. You need to provide ALLOWED_HOSTS in a list. Please check Django documentation for more..

    Debug = False
    ALLOWED_HOSTS = ['xyz.com']
    
    0 讨论(0)
  • 2020-12-20 06:44

    You can't use SQLite3 on Heroku. Switch to Postgres.

    0 讨论(0)
  • 2020-12-20 06:45

    You need to provide ALLOWED_HOSTS

    Debug = False
    ALLOWED_HOSTS = [".herokuapp.com"]
    

    And Heroku you should use PostgreSQL

    https://github.com/kennethreitz/dj-database-url

    0 讨论(0)
  • 2020-12-20 06:48

    Added this in the settings.py

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'handlers': {
            'console': {
                'class': 'logging.StreamHandler',
            },
        },
        'loggers': {
            'django': {
                'handlers': ['console'],
                 'level': os.getenv('DJANGO_LOG_LEVEL', 'DEBUG'),
            },
        },
    }
    

    Got the errors in the log Apparently there was a mismatch with the names of the folders in the remote server and my local machine

    0 讨论(0)
提交回复
热议问题