My very first python web app (no framework)
scardig at gmail.com
scardig at gmail.com
Mon Dec 10 03:20:12 EST 2007
On 9 Dic, 15:43, scar... at gmail.com wrote:
> This is my first Python web pseudo-app: "you give me some data, I give
> you func(data)". I'm on a shared host with mod_fastcgi so I installed
> a virtual python environment + flup (no middleware now, just wsgi
> server).
>
> ========= dispatch.fcgi =================
> from fcgi import WSGIServer
> import sys, cgi, cgitb,os
> import myfunctions
>
> def myapp(environ, start_response):
> start_response('200 OK', [('Content-Type', 'text/html')])
> write = []
> write.append (myfunctions.func1(par1,par2))
> write.append (myfunctions.func2(par1,par2))
> # [...]
> write.append (myfunctions.funcn(par1,par2))
> return [write]
>
> if __name__=="__main__":
> WSGIServer(myapp).run()
> ====================================
>
> ====== myfunctions.py ==================
> def func1(a,b):
> return a
> def func2(a,b):
> return b
> ====================================
>
> Is it the right way to go? Is it safe in a web production
> environment ? Is it thread-friendly (since flup is threaded) ?
>
> tnx
Any hint ?
More information about the Python-list
mailing list