Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » mod_wsgi sometimes gives error on first reload but not thereafter [RSS Feed]

#1 June 14, 2010 17:48:35

Chris S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


1. Restarting Apache+mod_wsgi
2. Clearing Firefox cache and
3. Visiting Django app URL

are all done often when debugging/developing a DJango app under Apache
+mod_wsgi.

I've noticed with mod_wsgi, I will *SOMETIMES* get an error after this
triad.

Reloading the Django URL makes it go away so it only appears on the
first visit to Django app.

I will see sometimes like "400 Bad Request" page in Firefox...

"""
Bad Request

Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.

er.com/set_up
"""

The DJango URL (I'm using Django auth) ishttps://seoconquer.com/sign_in?next=/set_upAny help greatly appreciated.

cs

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 15, 2010 01:02:08

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 15, 2:48 am, Chris Seberino <cseber...@gmail.com> wrote:
> 1. Restarting Apache+mod_wsgi
> 2. Clearing Firefox cache and
> 3. Visiting Django app URL
>
> are all done often when debugging/developing a DJango app under Apache
> +mod_wsgi.
>
> I've noticed with mod_wsgi, I will *SOMETIMES* get an error after this
> triad.
>
> Reloading the Django URL makes it go away so it only appears on the
> first visit to Django app.
>
> I will see sometimes like "400 Bad Request" page in Firefox...
>
> """
> Bad Request
>
> Your browser sent a request that this server could not understand.
> Request header field is missing ':' separator.
>
> er.com/set_up
> """
>
> The DJango URL (I'm using Django auth)
> ishttps://seoconquer.com/sign_in?next=/set_up>
> Any help greatly appreciated.

Use WSGI script described in:http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.htmlPlease let us know if this solves issue or not as still waiting for
confirmation that this helps solve that problem.

Graham

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 15, 2010 15:45:37

Chris S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 14, 7:02 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Use WSGI script described in:
>
>http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.htmlIn mod_wsgi's defense, remember that this error happens sporadically
and is NOT a showstopper as a reload makes it go away completely
(until a future restart).

I did look at that page a while back when we talked previously. It
helped me get mod_wsgi working. I'm not sure what you are asking me
to do....Do you want me to use the exact script and send you the
output of the print statements? Would my aforementioned error show up
in the Apache logs? If and when I see it again I will look in the
Apache error.log for clues too.

cs

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 16, 2010 00:16:50

Chris S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


I found the Apache error for this mod_wsgi error that only appears the
first time I reload an app after restarting Apache....

request
failed: error reading the headers, referer: http://<domain removed>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 June 16, 2010 00:40:27

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 16, 12:45 am, Chris Seberino <cseber...@gmail.com> wrote:
> On Jun 14, 7:02 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
>  > Use WSGI script described in:
>
>
>
> >http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html>
> In mod_wsgi's defense, remember that this error happens sporadically
> and is NOT a showstopper as a reload makes it go away completely
> (until a future restart).
>
> I did look at that page a while back when we talked previously.  It
> helped me get mod_wsgi working.  I'm not sure what you are asking me
> to do....Do you want me to use the exact script and send you the
> output of the print statements?  Would my aforementioned error show up
> in the Apache logs?  If and when I see it again I will look in the
> Apache error.log for clues too.

At the end of the document it has the alternate WSGI script file
contents as shown below. Simply use that and change the path to match
where your site is.

import sys

sys.path.insert(0, '/usr/local/django/mysite')

import settings

import django.core.management
django.core.management.setup_environ(settings)
utility = django.core.management.ManagementUtility()
command = utility.fetch_command('runserver')

command.validate()

import django.conf
import django.utils

django.utils.translation.activate(django.conf.settings.LANGUAGE_CODE)

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#6 June 16, 2010 00:42:07

Graham D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 16, 9:16 am, Chris Seberino <cseber...@gmail.com> wrote:
> I found the Apache error for this mod_wsgi error that only appears the
> first time I reload an app after restarting Apache....
>
> request
> failed: error reading the headers, referer: http://<domain removed>

That error from Apache would likely indicate the client browser or
otherwise sent malformed headers.

This occurs when Apache is first reading HTTP headers for request and
long before it hands it off to any Django application or even
mod_wsgi.

Graham

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#7 June 16, 2010 15:07:52

Chris S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 15, 6:42 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:

> This occurs when Apache is first reading HTTP headers for request and
> long before it hands it off to any Django application or even
> mod_wsgi.

Is there anything I can do about this? I assume this means we should
pronounce the mod_wsgi setup I have good and not bother trying to use
your sample script after all like you discussed in previous email?

cs

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#8 June 16, 2010 15:57:25

Matt H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

mod_wsgi sometimes gives error on first reload but not thereafter


On Jun 16, 3:07 pm, Chris Seberino <cseber...@gmail.com> wrote:
> On Jun 15, 6:42 pm, Graham Dumpleton <graham.dumple...@gmail.com>
> wrote:
>
> > This occurs when Apache is first reading HTTP headers for request and
> > long before it hands it off to any Django application or even
> > mod_wsgi.
>
> Is there anything I can do about this?  I assume this means we should
> pronounce the mod_wsgi setup I have good and not bother trying to use
> your sample script after all like you discussed in previous email?
>
Since it looks like a problem with the http communication between the
browser and the server you might find it worth hooking something like
TCPWatch (http://hathawaymix.org/Software/TCPWatch) in between the two
and look at what's going back and forth to try spot where the problem
is being introduced. On the face of it, it seems most likely it's your
copy of firefox misbehaving for some reason!

Matt

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » mod_wsgi sometimes gives error on first reload but not thereafter [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support