Hi

Thank you for the reply.

One of the reasons I am using mod_wsgi is to be able to understand a bit 
more about what goes on underneath.

Thus far I have not had too many problems with mod_wsgi - the tutorials 
give information both on logging requests/responses and debugging the 
pythonry, so I am happy to go with it at the moment. If I get in to real 
difficulty I will take a step back.

I already have a mass of stuff using cherrypy (which I understand has a 
hook for mod_wsgi, though I have not tried it yet), does Flask do 
anything different from CherryPy ?


On Wednesday, January 31, 2018 at 2:11:12 PM UTC, Larry Cotton wrote:

> Hi
> System Info:
>
> # cat /etc/redhat-release
> Red Hat Enterprise Linux Server release 6.4 (Santiago)
>
> # httpd -v
> Server version: Apache/2.4.25 (Unix)
> Server built:   Jun 27 2017 16:23:25
>
> # python --version
> Python 2.7.11
>
> -------------------------------------------------
>
> I have set up apache + mod_wsgi and have done some playing with it to help 
> get some understanding of how client  and server interact.
>
> I am new to mod_wsgi and have not yet used it in anger, but the simple 
> apps I have written seem to be working ok.
>
> However there is something I would like to understand regarding how the 
> browser decides when to render a page.
>
> In the simple application below(tst1.wsgi) below I generate a simple html 
> page that contains an image, logging the REQUEST_URI
> for each request.
>
> If, in the browser, I type the url <myserver>/wsgipractice/tst1/index the 
> browser attempts to fully render the page and puts in a second request to 
> get the image. The log output containing the REQUEST_URIs looks like:
> /wsgipractice/tst1/index
> /wsgipractice/tst1/images/myimage.jpg
>
> If, however, I type only the root url in the browser: 
> <myserver>/wsgipractice/tst1 the browser does not seem to attempt to render 
> the html page. No second request is put in to fetch the image. The log 
> output containing the REQUEST_URIs looks like:
> /wsgipractice/tst1
>
> It does not seem to matter what comes after tst1 in the url (I can type in 
> tst1/bob, or even simply terminate with separator: tst1/). 
>
> Does anyone know what it is that triggers the browser to fully (or not) 
> render a page ?
>
>
> tst1.wsgi
> ----------
> import os
>
> def get_page(environ, mime_type):
>
>     html_str = \
>         ('<html><body>'
>          '<center><p style="font-weight:bold;">LARRY HOME</p></center>'
>          '<div style="background-image: url(images/myimage.jpg)">'
>          '<a href="http://google.com";>'
>          '<div>Home</div></a>'
>          '</div>'
>          '<br><p>Body</p><br></body></html>')
>
>     return html_str, mime_type
>
> def application(environ, start_response):
>
>     status = '200 OK'
>
>     output = u''
>
>     log_file = open(('/logs/tstpagegen.log'), 'a')
>
>     log_file.write(environ['REQUEST_URI'] + '\n')
>
>     log_file.close()
>
>     output, mime_type = get_page(environ, 'text/html')
>
>     response_headers = [('Content-type', mime_type),
>                         ('Content-Length', str(len(output)))]
>
>     start_response(status, response_headers)
>
>     return [output]
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to