|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
||||
|
||||
|
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 ![]() http://www.modpython.org/ http://www.onlamp.com/pub/a/python/...mod_python.html Long time no see, hope everythings well with you! Mark. |
|
#3
|
|||
|
|||
|
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: Code:
#!/usr/bin/env python
import sys, time
state = 0
def twist(symbols):
global state
sys.stdout.write(symbols[state] + '\r')
if state == len(symbols) - 1:
state = -1
state = state + 1
if __name__ == '__main__':
while True:
twist(('|', '/', '-', '\'))
time.sleep(1)
netytan: You wrote this script. I found it here 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. |
|
#4
|
||||
|
||||
|
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!Mark. Last edited by netytan : January 29th, 2004 at 06:58 AM. |
|
#5
|
|||
|
|||
|
I have 3.0.4. I'll get the latest version with PSP. What is that, by the way?
|
|
#6
|
||||
|
||||
|
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
![]() http://www.modpython.org/live/mod_p...l/hand-psp.html 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 Mark. |
|
#8
|
|||
|
|||
|
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) |
|
#9
|
||||
|
||||
|
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. Mark. Last edited by netytan : January 29th, 2004 at 08:10 AM. |
|
#10
|
|||
|
|||
|
How come all of my test files are saying "Hello World!"? Only mptest.py is supposed to do that.
|
|
#11
|
||||
|
||||
|
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.Quote:
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. Mark. |
|
#12
|
|||
|
|||
|
I'm just getting blank screens...
I added: <Directory "C:/Documents and Settings/Spencer/My Documents/Apache2/htdocs/"> AddHandler python-program .py PythonHandler mod_python.cgihandler PythonDebug On </Directory> to my httpd file. Do I save the files as .py (like I'm doing now) or .cgi? |
|
#13
|
||||
|
||||
|
Yeah you save it with a .py file and write the CGI file as normal i.e.
Code:
#!/usr/bin/env python print 'Content-Type: text/html\n' print 'Hello World!' Mark. |