Hello,

Please explain how the do method will be called?

There must be a callable in the wsgi file named "application"... As it
stands, you have an instance of a "handler" class that cannot be called.

Consider refactoring as a simle function called "application" just to role
out those issues... Theb, once working, expand it.

By the way, wsgi itself is a bit raw, so unless your main goal is to develop
another framework, I strongly suggest you use a framework.

Both bottle and appstruct are very lightweight.  I can help you off list
with the latter...

-jg
On Oct 24, 2010 2:57 AM, "nitin chandra" <[email protected]> wrote:
> Well tried a fresh approach ... and here are the following setting of
> httpd.conf and index.py
> I am sure this must be easy ... but i am not able to locate the issue,
> and therefore trouble shoot it.... else it must NOT be 'this'
> difficult to display the simple html lines.
> This is on Ubuntu 64bit (VM) 10.04,
> my "index.wsgi" and "index.py" are in '/home/dev/wsgi-scripts/'
> directory. LATER, will shift 'index.py' and other *.py and various
> project related files, into another directory (
> /home/dev/healthcare.in/).
>
> Error is "500 Internal Server Error" and in end, error_log entries are
pasted.
>
> < not ready to give up .... yet >
>
> As I keep getting familiar with the development architecture, i shall
> trouble the list , lot less :)
>
> TIA
>
> Nitin
>
>
> my httpd.conf
> -----------------------
> ServerRoot "/opt/apache2215"
>
> Listen 192.168.1.6:80
>
> LoadModule wsgi_module modules/mod_wsgi.so
>
> User daemon
> Group daemon
>
> ServerAdmin [email protected]
>
> ServerName www.healthcare.in
>
> DocumentRoot "/opt/apache2215/htdocs"
>
> <Directory />
> Options MultiViews
> AllowOverride None
> Order deny,allow
> Deny from all
> </Directory>
>
> <Directory "/opt/apache2215/htdocs">
> Options Indexes FollowSymLinks
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
>
> <IfModule dir_module>
> DirectoryIndex index.html index.wsgi index.py
> </IfModule>
>
> <Directory "/opt/apache2215/cgi-bin">
> AllowOverride None
> Options MultiViews
> Order allow,deny
> Allow from all
> </Directory>
>
> NameVirtualHost 192.168.1.6:80
> <VirtualHost 192.168.1.6:80>
> ServerName www.healthcare.in
> ServerAlias healthcare.in
> Redirect / https://www.healthcare.in/index.wsgi
> WSGIDaemonProcess healthcare.in processes=6 threads=15
display-name=%{GROUP}
> WSGIProcessGroup healthcare.in
> WSGIScriptAlias / /home/dev/wsgi-scripts/
> <Directory /home/dev/wsgi-scripts>
> Options MultiViews
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
> Listen 192.168.1.6:443
> AddType application/x-x509-ca-cert .crt
> AddType application/x-pkcs7-crl .crl
> SSLPassPhraseDialog builtin
> SSLSessionCache "shmcb:/tmp/ssl_scache(512000)"
> SSLSessionCacheTimeout 300
> SSLMutex "file:/tmp/ssl_mutex"
>
> <VirtualHost 192.168.1.6:443>
> DocumentRoot "/home/dev/wsgi-scripts/"
> ServerName www.healthcare.in
> ServerAdmin [email protected]
> SSLEngine on
> SSLCipherSuite
> ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
> SSLCertificateFile "/etc/cups/ssl/server.crt"
> SSLCertificateKeyFile "/etc/cups/ssl/server.key"
> <FilesMatch "\.(cgi|shtml|phtml|php|py|pyc)$">
> SSLOptions +StdEnvVars
> </FilesMatch>
> <Directory /home/dev/wsgi-scripts>
> Options MultiViews
> Order allow,deny
> Allow from all
> SSLOptions +StdEnvVars
> Options ExecCGI
> SetHandler wsgi-script
> WSGIProcessGroup healthcare.in
> </Directory>
> BrowserMatch ".*MSIE.*" \
> nokeepalive ssl-unclean-shutdown \
> downgrade-1.0 force-response-1.0
> </VirtualHost>
>
> <IfModule ssl_module>
> SSLRandomSeed startup builtin
> SSLRandomSeed connect builtin
> </IfModule>
>
> ==================================================
> index.py
> ----------
>
> #!/usr/bin/env python
>
> import os, re
> from datetime import datetime
>
> class Handler:
> def do(self, environ, start_response):
> uri = environ['REQUEST_URI']
> html = "<html><head><title>Index of %s</title></head><body>" % uri
> html += "<h1>Index of %s</h1>" % uri
> html += "<table border='0'>"
> html += '<tr><th>Last
> ModifiedL</t><th>Size</th><th>Description</th><th>Webifiable</th><tr><th
> colspan="6"><hr></th></tr>'
> html += '<tr><td><a href="..">Parent
> Directory</a></td><td>&nbsp</td><td align="right"> -
> </td><td>&nbsp;</td><td>&nbsp;</td></tr>'
> html += '<tr><th colspan="6"><hr></th></tr>'
> html += "</tables>"
> html += "</body></html>"
> output = html
> mimeType = "text/html"
>
> status = "200 OK"
> response_headers = [("Content-type", mimeType),
> ("Content-length", str(len(output)))]
>
> application = Handler()
>
> """
> (environ, status_response):
> start_response(status, response_header)
> return [output]
> """
> ---------------------------------------
> from /opt/apache2215/log/error_log
>
>
> [Sun Oct 24 11:50:12 2010] [error] [client 192.168.1.9] mod_wsgi
> (pid=1414): Exception occurred processing WSGI script
> '/home/dev/wsgi-scripts/index.py'.
> [Sun Oct 24 11:50:12 2010] [error] [client 192.168.1.9] Traceback
> (most recent call last):
> [Sun Oct 24 11:50:12 2010] [error] [client 192.168.1.9] File
> "/home/dev/wsgi-scripts/index.py", line 24, in <module>
> [Sun Oct 24 11:50:12 2010] [error] [client 192.168.1.9]
> application = Handler(application)
> [Sun Oct 24 11:50:12 2010] [error] [client 192.168.1.9] NameError:
> name 'application' is not defined
>
> --
> You received this message because you are subscribed to the Google Groups
"modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
[email protected]<modwsgi%[email protected]>
.
> For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to