[newbie] My very first python web app (no framework)

S

scardig

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
 
S

scardig

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 ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top