I've started Python programming a several months ago and have since
began a website completely driven by Python (to enhance my Python
knowledge). My Python web pages were basically standards Python
scripts you can write up in Notepad, but with the added HTML
formatting.
For example, a script of mine looks like this on my PC:
length = range(1,20)
for num in length:
print num*2
But then I obviously adapt it to output correctly in a browser:
print "Content-Type..."
print
print "<html>....<body>"
length = range(1,20)
for num in length:
print num*2,"<br />"
print "</body></html>"
I then place it in the cgi-bin and execute it. Works wonderfully. The
thing is, Bluehost's speed has begun to degrade and their Python
support is average at best. So I'm moving to a host with better
support and with better alternatives to CGI. Now, I'm confused with
how I'm going to get my Python pages working under mod_wsgi. Do I have
to completely rewrite each script for it to work? Is it possible for
my Python scripts in their current format to work under mod_wsgi? I'm
completely lost on how I'm going to create seperate pages too. I've
Googled but found haven't found too much.
I've gotten mod_wsgi to work on my PC and I've gotten this wsgi script
to run (a modified hello world script):
#!C:\Python26\python.exe
def application(environ, start_response):
numbers = ""
for x in range(1,20):
numbers += str(x)+" - "
file = open("\header.html").read()
start_response('200 OK', [('Content-Type', 'text/html')])
return [ file, numbers ]
print "Why won't you work?!"
The thing is, it doesn't print the last line. I know I'm doing
something wrong and I know my idea of what mod_wsgi is probably
skewed. If anyone can shed some light on my issues I'd really
appreciate it. I just want the added bonus of mod_wsgi while using the
standard Python scripting format, but it doesn't seem as if that's
possible...
- Shady
--
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.