Well this is neat. Following the advice of Collin Anderson,
https://groups.google.com/d/msg/django-users/d_aWdw_AhH0/424ABkRajaoJ

I removed the LOGGING stuff, which wasn't that interesting anyway.
And then the exception emails started appearing!

I got this,

> Invalid HTTP_HOST header: 'localhost:8000'. You may need to add
> 'localhost' to ALLOWED_HOSTS.

which was a surprise to me because I already had 'localhost:*' in
my settings, but I switched it and it indeed worked on the development
server. For example, this returned the admin login page.

    curl 'http://localhost:8000/admin/login/?next=/admin/'

But it still didn't work with the Apache server. ('scott.dada.pink',
the host that Apache watches for, had always been in ALLOWED_HOSTS.)
So I removed 'localhost' from ALLOWED_HOSTS and tried this.

    curl -H 'host: scott.dada.pink' 
'http://localhost:8000/admin/login/?next=/admin/'

It returned the same web page, even though the host was not in
ALLOWED_HOSTS. I guess the development server does not care about
ALLOWED_HOSTS?

    curl -H 'host: scott.dada.pink' 
'http://localhost:8000/admin/login/?next=/admin/'

Unfortunately, while email works with the development server,
it does not work on the production server, and I have yet to figure
out why.

On 07 May 13:43, Thomas Levine wrote:
> Hi,
> 
> Every page on my site returns a status code of 400 when I set
> `debug = False` in my settings file, and this doesn't happen
> if I switch it to `True`. How can I determine what is going wrong?
> 
> I have not managed to find it in the Django loggers (through email
> or through a custom logging facility), the console output of the
> development server, nor the logs of the production server (Apache).
> Well I do see it in the development server output, but only as this:
> 
>     [07/May/2015 13:38:38]"GET /admin/ HTTP/1.0" 400 0
> 
> In case I should be able to find the issue in those places and I
> am just doing something wrong, here are my settings.
> http://dada.pink/scott2/scott2/settings.py
> 
> I believe that neither the `settings.py` nor even `wsgi.py` files
> are being run, as adding the following lines to their tops did not
> produce `settings.pyabc` nor `wsgi.pyabc`, respectively.
> 
>     with open(__file__ + 'abc', 'w') as fp:
>         fp.write('abc')
> 
> Thanks
> 
> Tom
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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/20150507134350.GA25982%40d1stkfactory.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/20150507181137.GA3658%40d1stkfactory.
For more options, visit https://groups.google.com/d/optout.

Reply via email to