Hi
Thank you for your reply.
I was naively thinking that because I did not see a request arrive it was
not sent by the browser, but of course it is probably being filtered out by
apache. I have included a summary of the apache configuration I am using in
case there is anything obvious there you can see, but I guess I really need
to gen up on what apache does before the requests are handed to the
mod_wsgi app. A quick google suggests the forensic logging module
(mod_log_forensic) allows logging of requests before and after processing -
looks like this would help.
DocumentRoot "/myserver/usr/local/apache/htdocs"
<Directory "/myserver/usr/local/apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<VirtualHost *:80>
ServerName myserver.loc.comp.com
ServerAlias myserver
ServerAdmin admin@gmail
DocumentRoot "/myserver/usr/local/apache/htdocs"
<Directory /myserver/usr/local/apache/htdocs>
Options Indexes FollowSymLinks
Require all granted
</Directory>
WSGIDaemonProcess myserver processes=2 threads=15 display-name=%{GROUP}
maximum-requests=10000
python-path=/myserver/usr/local/apache/wsgi-practice-scripts
WSGIProcessGroup myserver
WSGIScriptAliasMatch ^/wsgipractice/([^/]+)
/myserver/usr/local/apache/wsgi-practice-scripts/$1.wsgi
WSGIProcessGroup myserver
<Directory /myserver/usr/local/apache/wsgi-practice-scripts>
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
On Thursday, February 1, 2018 at 11:02:29 AM UTC, Graham Dumpleton wrote:
> How are you configuring Apache for mod_wsgi?
>
> Your code works, so the problem is likely how you are setting up the
> serving of the static file by Apache.
>
> Graham
>
> On 1 Feb 2018, at 9:14 pm, Larry Cotton <[email protected] <javascript:>>
> wrote:
>
> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
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.