You must set settings.ALLOWED_HOSTS if DEBUG is False. Django-r-f

Issue

I want to prepare the server for deployment and this is the setup.
settings.py is split into dev.py and prod.py

in settings.py at the bottom ALLOWED_HOSTS = []
I also have tried ALLOWED_HOSTS = ['*']

dev.py

    from ..settings.settings import *
    DEBUG = True

    

wsgy.py

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'movie_api.settings.dev')

    CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.

When I import settings in the manage.py shell, the settings.DEBUG = False .. why?
How to make wsgi.py read the correct file?

Solution

I solved the problem by changing the settings path in manage.py

Answered By – Brat

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published