[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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top