I created a new django project; added to my settings.py:
DEBUG = False ALLOWED_HOSTS= [ 'localhost', 'my_site.com' ]
created test_view application; added by hello_world to test_view.views
from django.http.response import HttpResponse def hello_world(request): return HttpResponse('Hello World!!!')
added test route to urls.py url(r'test/', 'test_view.views.hello_world') ; fixed / etc / hosts
127.0.0.1 localhost my_site.com
Now when I try to access http://my_site.com:8000/test/ , django returns Bad Request (400). But when url is http://localhost:8000/test/ , I see my Hello World page. What could be wrong?
UPD: Same result with DEBUG = True
UPD2:
Another working host name is ubuntu-virtualbox (computer name). But even when I changed the computer name to my_site , ubuntu-virtualbox was still available, and my_site returned Bad Request (400)
Maybe this is due to some system settings? (it clears ubuntu in virtualbox). Or maybe the problem is in virtualenv? Is there a way to track the error?
django bad-request
Anton Aug 18 '14 at 6:52 2014-08-18 06:52
source share