2006-08-23 13:27:25 +00:00
|
|
|
#!/usr/bin/env python2.4
|
2006-08-24 00:06:19 +00:00
|
|
|
import os
|
2006-09-07 11:21:56 +00:00
|
|
|
import WebInterfaceSites
|
2006-10-11 15:51:28 +00:00
|
|
|
import sys
|
2006-08-20 16:33:52 +00:00
|
|
|
|
2006-08-18 21:45:40 +00:00
|
|
|
try:
|
|
|
|
import cherrypy
|
|
|
|
except:
|
2006-08-25 07:37:52 +00:00
|
|
|
print "Could not import the cherrypy module! Try 'apt-get install python-cherrypy'."
|
2006-08-18 21:45:40 +00:00
|
|
|
sys.exit(1)
|
|
|
|
|
2006-08-24 00:06:19 +00:00
|
|
|
class CryptoBoxWebserver:
|
|
|
|
'''this class starts the cherryp webserver and serves the single sites'''
|
2006-08-18 21:45:40 +00:00
|
|
|
|
2006-08-24 00:06:19 +00:00
|
|
|
def __init__(self):
|
2006-09-07 11:21:56 +00:00
|
|
|
cherrypy.root = WebInterfaceSites.WebInterfaceSites()
|
2006-08-24 00:06:19 +00: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 15:03:16 +00: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 00:06:19 +00:00
|
|
|
"staticFilter.on" : True,
|
2006-09-05 15:03:16 +00:00
|
|
|
"staticFilter.dir": os.path.abspath("../www-data" )}
|
|
|
|
})
|
2006-08-24 00:06:19 +00:00
|
|
|
|
|
|
|
def start(self):
|
2006-09-25 12:22:41 +00:00
|
|
|
# just use this config, when we're started directly
|
2006-09-04 06:02:53 +00:00
|
|
|
cherrypy.config.update(file = "cryptoboxwebserver.conf")
|
2006-08-24 00:06:19 +00:00
|
|
|
cherrypy.server.start()
|
2006-08-18 21:45:40 +00:00
|
|
|
|
2006-08-20 16:33:52 +00:00
|
|
|
if __name__ == "__main__":
|
2006-08-24 00:06:19 +00:00
|
|
|
cbw = CryptoBoxWebserver()
|
|
|
|
cbw.start()
|
2006-08-16 12:52:23 +00:00
|
|
|
|