Can't run django!

146 views
Skip to first unread message

David Zahedi

unread,
Mar 4, 2015, 2:15:32 PM3/4/15
to django...@googlegroups.com
Hi there,

I am using python 2.7 and django 1.75; when I run "manage.py runserver" I get the following error:

CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False.
An exception has occurred, use %tb to see the full traceback.


My DEBUG is True.

Thanks

James Schneider

unread,
Mar 4, 2015, 2:54:35 PM3/4/15
to django...@googlegroups.com
Is there a possibility of having more than one settings file? If so, ensure that your manage.py is pointing at the right settings file. The output of 'manage.py runserver' should also show the dotted path of the settings file that it is using just before that error is displayed (I believe). 

You can also verify that your DEBUG value is being correctly parsed by running 'manage.py diffsettings'. One of the lines of output should be 'DEBUG = True' since DEBUG defaults to False. If it isn't there, then your DEBUG setting is somehow set to True (or may be missing from your settings.py file). If you are on a Linux host shell, you can run 'python manage.py diffsettings | grep DEBUG' to filter the lines containing DEBUG or on Windows 'manage.py diffsettings | find "DEBUG" '.

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea41d3e8-4d93-4076-8df8-a099360d13aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Farrell

unread,
Mar 4, 2015, 3:08:41 PM3/4/15
to django...@googlegroups.com
You might see if DEBUG is being set to False in an unexpected location by using the silver searcher (also on windows) to quickly search for a string in a directory tree.

$ ag DEBUG 

within your app should tell you all of the places it is being set.

--

Bill Blanchard

unread,
Mar 4, 2015, 4:32:05 PM3/4/15
to django...@googlegroups.com
Can we see a sanitized version of your settings file?  My guess is there's probably a typo in there somewhere.

--
Reply all
Reply to author
Forward
0 new messages