2006-08-23 15:27:25 +02:00
|
|
|
#!/usr/bin/env python2.4
|
2006-08-24 02:06:19 +02:00
|
|
|
import os
|
|
|
|
import CryptoBoxWebserverSites
|
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):
|
|
|
|
cherrypy.root = CryptoBoxWebserverSites.CryptoBoxWebserverSites()
|
|
|
|
#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-08-25 09:37:52 +02:00
|
|
|
# [l] why do we need to map the css manually? Shouldn't the whole
|
|
|
|
# www-data path be accessible anyway?
|
2006-08-24 02:06:19 +02:00
|
|
|
cherrypy.config.configMap.update(
|
|
|
|
{
|
|
|
|
"/cryptobox.css": {
|
|
|
|
"staticFilter.on" : True,
|
|
|
|
"staticFilter.file": os.path.abspath("../www-data/cryptobox.css" )
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
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
|
|
|
|