need help

58 views
Skip to first unread message

Abdoulaye SENE

unread,
Jul 4, 2023, 2:38:19 PM7/4/23
to Django users
hello,
while programming, i see this problem : " CommandError: You must set settings.ALLOWED_HOSTS if DEBUG is False."
i wonder if someone can help me to fix it.

ALBERT ASHABA AHEEBWA

unread,
Jul 4, 2023, 2:44:45 PM7/4/23
to django...@googlegroups.com
Go to your settings.py and look for allowed_hosts and make it 
ALLOWED_HOSTS = ["*"]

or better yet, if you are in development, turn
DEBUG = False



Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/171c894c-5f04-445d-939f-c6c949caae35n%40googlegroups.com.

ALBERT ASHABA AHEEBWA

unread,
Jul 4, 2023, 2:46:01 PM7/4/23
to django...@googlegroups.com
Sorry I meant turn 
DEBUG = True




Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

Abdoulaye SENE

unread,
Jul 4, 2023, 3:20:37 PM7/4/23
to Django users
thanks for the help. but after  writing ["*"] i see   Server Error (500)

ALBERT ASHABA AHEEBWA

unread,
Jul 4, 2023, 3:25:11 PM7/4/23
to django...@googlegroups.com
Server Error can be caused by many issues ranging from database queries to wrong urls.

Turn debug to true and see what reasons are given .
Are you in production or development? 




Best Regards,

Albert Ashaba Aheebwa
+256 781 435857

Theresa Taye

unread,
Jul 4, 2023, 3:45:33 PM7/4/23
to django...@googlegroups.com
Hello,

You see a Server error because Debug is set to False. To know what the actual error is, turn it back to True. Then when you are done debugging you can change that especially if you are pushing to production.

Bouka Largent

unread,
Jul 5, 2023, 5:49:56 PM7/5/23
to django...@googlegroups.com

DieHardMan 300

unread,
Jul 6, 2023, 1:12:34 AM7/6/23
to Django users
On the server, change the following in settings
DEBUG = True                    # django will tell what cause the error instead of error500
ALLOWED_HOST = ["*"]    # this allow all hosts but you should do this only for testing
    most of the time, error 500 often cause from database connection problems in server side, you should create new user in database and give permissions to that user (do no use root user)
ในวันที่ วันพฤหัสบดีที่ 6 กรกฎาคม ค.ศ. 2023 เวลา 0 นาฬิกา 49 นาที 56 วินาที UTC+7 Bouka Largent เขียนว่า:

ivan harold

unread,
Aug 9, 2023, 2:48:16 PM8/9/23
to Django users
was the issue solved?
Do you need any assistance?
Reply all
Reply to author
Forward
0 new messages