Search code examples
pythondjangodjango-rest-frameworkdeploymentdjango-settings

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


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