2006-08-23 15:27:25 +02:00
|
|
|
#!/usr/bin/env python2.4
|
2006-08-24 02:06:19 +02:00
|
|
|
import os
|
2006-09-07 13:21:56 +02:00
|
|
|
import WebInterfaceSites
|
2006-08-20 18:33:52 +02:00
|
|
|
|
2006-08-18 23:45:40 +02:00
|
|
|
try:
|
|
|
|
import cherrypy
|
|
|
|
except:
|
2006-08-25 09:37:52 +02:00
|
|
|
print "Could not import the cherrypy module! Try 'apt-get install python-cherrypy'."
|
2006-08-18 23:45:40 +02:00
|
|
|
sys.exit(1)
|
|
|
|
|
2006-08-24 02:06:19 +02:00
|
|
|
class CryptoBoxWebserver:
|
|
|
|
'''this class starts the cherryp webserver and serves the single sites'''
|
2006-08-18 23:45:40 +02:00
|
|
|
|
2006-08-24 02:06:19 +02:00
|
|
|
def __init__(self):
|
2006-09-07 13:21:56 +02:00
|
|
|
cherrypy.root = WebInterfaceSites.WebInterfaceSites()
|
2006-08-24 02:06:19 +02:00
|
|
|
#expose static content:
|
|
|
|
#I currently have no idea how to cleanly extract the stylesheet path from
|
|
|
|
#the config object without an extra CryptoBox.CryptoBoxProps instance.
|
|
|
|
#perhaps put config handling into a seperate class in CryptoBox.py?
|
2006-09-05 17:03:16 +02:00
|
|
|
#
|
|
|
|
# the following manual mapping is necessary, as we may not use relative
|
|
|
|
# paths in the config file
|
|
|
|
cherrypy.config.configMap.update({
|
|
|
|
"/cryptobox-misc": {
|
2006-08-24 02:06:19 +02:00
|
|
|
"staticFilter.on" : True,
|
2006-09-05 17:03:16 +02:00
|
|
|
"staticFilter.dir": os.path.abspath("../www-data" )}
|
|
|
|
})
|
2006-08-24 02:06:19 +02:00
|
|
|
|
|
|
|
def start(self):
|
2006-09-25 14:22:41 +02:00
|
|
|
# just use this config, when we're started directly
|
2006-09-04 08:02:53 +02:00
|
|
|
cherrypy.config.update(file = "cryptoboxwebserver.conf")
|
2006-08-24 02:06:19 +02:00
|
|
|
cherrypy.server.start()
|
2006-08-18 23:45:40 +02:00
|
|
|
|
2006-08-20 18:33:52 +02:00
|
|
|
if __name__ == "__main__":
|
2006-08-24 02:06:19 +02:00
|
|
|
cbw = CryptoBoxWebserver()
|
|
|
|
cbw.start()
|
2006-08-16 14:52:23 +02:00
|
|
|
|