Django.core.exceptions.ImproperlyConfigured: The ALLOWED_HOSTS setting must be a list or a tuple after upgrading Django

Hi I upgrade the django and after that I'm getting this error django.core.exceptions.ImproperlyConfigured: The ALLOWED_HOSTS setting must be a list or a tuple. but in my setting.py file the ALLOWED_HOSTS is already in the list

config.py

DJANGO_CONFIG = {
'secret_key': 'fadfas-------',
'debug': False,
'admin_module': True,
'allowed_hosts': '[\'*\']',
'server_host': 'http://127.0.0.1:8000',
}

setting.py

ALLOWED_HOSTS = DJANGO_CONFIG['allowed_hosts']

If you want to allow any particular ip you can add it as shown below.

ALLOWED_HOSTS = ['127.0.0.1']

And if want to allow all, add it as shown below

ALLOWED_HOSTS = ['*']

Hope this helps.

Back to Top