January 28th, 2004, 01:57 AM
Trusting that snake
Some people have told me that Python is very slow. This has scared me. I love Python. Personally, I think that it's the best language.
I wanted to start a big project. I wanted to make my own forum. Can I trust Python to be able to be fast enough?
January 28th, 2004, 03:17 AM
Yes!!!! Pythons fast enough for nearly all business applications and even then you can replace slow bits it with C/C++ and watch it burn!
Really dont worry about it Chief, the page will - usually - be created by the server and waiting for the visitors browser to load it well in advance!
Now, if you are really worried about prefomance you should look into mod_python
Long time no see, hope everythings well with you!
January 28th, 2004, 11:02 PM
I now have mod_python.
How do I execute my Python scripts anywhere on my Apache Web server?
Lets use the following as our test script:
netytan: You wrote this script. I found it here
import sys, time
state = 0
sys.stdout.write(symbols[state] + '\r')
if state == len(symbols) - 1:
state = -1
state = state + 1
if __name__ == '__main__':
twist(('|', '/', '-', '\'))
I hope you don't mind. I will remove it if you would like and use a different test script.
Last edited by MasterChief; January 28th, 2004 at 11:08 PM.
January 29th, 2004, 06:46 AM
Naw i don't mind one bit chief, you're welcome to use any of the code i've writen, smash it, rewrite whatever
saddly due to the nature of http this script aint gonna work for you since browers cant remove content once it's been displayed like in consols.
What versions of mod_python/python/handler are you using? I think the latest or next version is going to includes PSP so that could be fun!
Edit: Now that i think about it it might be worth using the beta version with PSP and putting up with any little bugs untill the final release is done; that way you're app will be one of the first to use "true" PSP, which is a nice little side heading . Also, if you email me i might have a little treat for you!
Last edited by netytan; January 29th, 2004 at 06:58 AM.
January 29th, 2004, 07:02 AM
I have 3.0.4. I'll get the latest version with PSP. What is that, by the way?
January 29th, 2004, 07:24 AM
PSP or Python Server Pages are a way of embedding Python in HTML similar to the way PHP or ASP does it. There are a few different systems around but none are gonna be as fast as mod_pythons PSP handler so
If not you can always write you're own handler. the CGI hander is pretty nice though, its pretty much fastCGI.. which reminds me i should really install that
January 29th, 2004, 07:50 AM
Horrah! It works!
If you're interested in looking at the working test-file, go here.
It just says "Hello World!"
Note how fast it loads/executes!
Last edited by MasterChief; January 29th, 2004 at 08:59 AM.
January 29th, 2004, 08:00 AM
I either don't have PSP, I don't have it enabled, or it's just not working.
I have mod_python 3.1.2b (Win32)
January 29th, 2004, 08:07 AM
Cute . you got broad band then? Anyway i'm still trying to get PSP working myself, seems to be broken, or at least in the windows version.
Edit: Ah, cant get this working at all, it just ignores the tags so i'm gonna stick with mod_pythons CGI handler for now.
Last edited by netytan; January 29th, 2004 at 08:10 AM.
January 29th, 2004, 08:16 AM
How come all of my test files are saying "Hello World!"? Only mptest.py is supposed to do that.
January 29th, 2004, 08:21 AM
Ah you created you're own handler that outputs 'Hello World!' heh. you apache config should look like this if you want to use Python CCI.
Then just write CGi programs as normal. The publisher handler is just nuts and gets on my nerves so
Note: set the directory yourself. i dont know where you have apacje installed so.
January 29th, 2004, 08:33 AM
I'm just getting blank screens...
<Directory "C:/Documents and Settings/Spencer/My Documents/Apache2/htdocs/">
AddHandler python-program .py
to my httpd file. Do I save the files as .py (like I'm doing now) or .cgi?
January 29th, 2004, 08:49 AM
Yeah you save it with a .py file and write the CGI file as normal i.e.
print 'Content-Type: text/html\n'
print 'Hello World!'
January 29th, 2004, 09:02 AM
All right, it works. You can view it here.
January 29th, 2004, 09:10 AM
no problem Chief, liked the link ! Oh, i'm writing a module you might be interested in being as you're writing a web application!