[python] mini web server
Jarda Pachola
j_p_misc na centrum.cz
Pátek Srpen 22 11:05:27 CEST 2003
A nestacilo by to udelat pres dva thready?
J.
> javorove listy se opet hlasi ke slovu ;-)
>
> v emailove adrese nepouziva diakritiku, tak nas lehce rozeznate ;-),
> krome toho javoru, of course...a ted proc pisu:
>
> toz chlapi, cozpak nikdo nevi, jak toto udelat? oni, takove kapacity? ;-)
>
> On Sun, Feb 09, 2003 at 08:30:29PM +0100, Petr Vanek wrote:
> > On Mon, Feb 03, 2003 at 09:12:01PM +0100, Michal Molhanec wrote:
> > > On Mon, 3 Feb 2003 20:47:26 +0100 Petr Vanek <vanous na penguin.cz> wrote:
> > > jiste viz dokumentace - moduly: SimpleHTTPServer, CGIHTTPServer,
> > > BaseHTTPServer, SocketServer atd. dle libosti
> >
> > diky vsem, uz mi to beha, jeste mam jeden dotaz:
> > potrebuji spustit z jednoho scriptu dva servery (jeden httpd, druhy pro
> > sql server), nicmene po spusteni jednoho se na ten druhy uz nedostane
> > rada...musim pouzit fork (popr. popen), nebo to jde i jinak? nechci
> > spoustet dva scripty...
> >
> > prikladam onen proklad:
> > PORT = 2222
> > #DB = "test"
> > DB = "books"
> > #DBDIR = "/home/vanous/htbin/db"
> > DBDIR = "/home/dokumenty/python/bookshelve/bookdb"
> > PW = "admin"
> > STARTUP = "servers"
> > doc_root = ('/home/vanous/htbin/')
> >
> > import sys, socket
> > from gadfly.server import Server, Policy
> > from gadfly.client import gfclient
> > import BaseHTTPServer, SimpleHTTPServer, CGIHTTPServer
> > import os
> >
> > def run(HandlerClass = CGIHTTPServer.CGIHTTPRequestHandler, ServerClass =
> > BaseHTTPServer.HTTPServer): server_address=('',7000)
> > httpd=ServerClass(server_address, HandlerClass)
> > os.chdir(doc_root)
> > httpd.serve_forever()
> >
> > def main():
> > machine = 'localhost' #socket.gethostname()
> > port = PORT
> > print "attempting to start the server"
> > print "making a server on", PORT, DB, DBDIR, PW, STARTUP
> > S = Server(PORT, DB, DBDIR, PW, STARTUP)
> > print "initializing the server"
> > S.init()
> > print "starting the server", S.connection
> > S.start()
> >
> >
> > def startup(admin_policy, connection, Server_instance):
> > print
> > # admin_policy["dumpwork"] = "select * from work"
> > # test1 = Policy("test1", "test1", connection, queries=0)
> > # test = Policy("test", "test", connection, queries=0)
> > # test1["qlike"] = "select * from likes where drinker=?"
> > # test["updatenan"] = """
> > # update likes
> > # set beer=?, perday=?
> > # where drinker='nan'
> > # """
> > # test["getnan"] = """
> > # select * from likes where drinker='nan'
> > # """
> > # from CGIHTTPServer import test
> > # test()
> >
> >
> > if __name__=="__main__":
> > main()
------------- další část ---------------
_______________________________________________
python mailing list
python na py.cz
http://py.cz/mailman/listinfo/python
Další informace o konferenci Python