mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Don't crash if we couldn't import ExMachina.
This commit is contained in:
parent
bef0bcecca
commit
ea49a08675
41
plinth.py
41
plinth.py
@ -17,7 +17,6 @@ from util import *
|
||||
from logger import Logger
|
||||
#from modules.auth import AuthController, require, member_of, name_is
|
||||
|
||||
from exmachina import ExMachinaClient
|
||||
import socket
|
||||
|
||||
__version__ = "0.2.14"
|
||||
@ -100,11 +99,16 @@ def setup():
|
||||
pass
|
||||
|
||||
try:
|
||||
cfg.exmachina = ExMachinaClient(
|
||||
secret_key=cfg.exmachina_secret_key or None)
|
||||
except socket.error:
|
||||
from exmachina import ExMachinaClient
|
||||
except ImportError:
|
||||
cfg.exmachina = None
|
||||
print "couldn't connect to exmachina daemon, but continuing anyways..."
|
||||
else:
|
||||
try:
|
||||
cfg.exmachina = ExMachinaClient(
|
||||
secret_key=cfg.exmachina_secret_key or None)
|
||||
except socket.error:
|
||||
cfg.exmachina = None
|
||||
print "couldn't connect to exmachina daemon, but continuing anyways..."
|
||||
|
||||
os.chdir(cfg.file_root)
|
||||
cherrypy.config.update({'error_page.404': error_page_404})
|
||||
@ -124,25 +128,26 @@ def setup():
|
||||
server.subscribe()
|
||||
|
||||
# Configure default server
|
||||
cherrypy.config.update({'server.socket_host': cfg.host,
|
||||
'server.socket_port': cfg.port,
|
||||
'server.thread_pool':10,
|
||||
'tools.staticdir.root': cfg.file_root,
|
||||
'tools.sessions.on':True,
|
||||
'tools.auth.on':True,
|
||||
'tools.sessions.storage_type':"file",
|
||||
'tools.sessions.timeout':90,
|
||||
'tools.sessions.storage_path':"%s/data/cherrypy_sessions" % cfg.file_root,
|
||||
|
||||
})
|
||||
cherrypy.config.update(
|
||||
{ 'server.socket_host': cfg.host,
|
||||
'server.socket_port': cfg.port,
|
||||
'server.thread_pool':10,
|
||||
'tools.staticdir.root': cfg.file_root,
|
||||
'tools.sessions.on':True,
|
||||
'tools.auth.on':True,
|
||||
'tools.sessions.storage_type':"file",
|
||||
'tools.sessions.timeout':90,
|
||||
'tools.sessions.storage_path':
|
||||
"%s/data/cherrypy_sessions" % cfg.file_root,
|
||||
})
|
||||
|
||||
config = {'/': {'tools.staticdir.root': '%s/static' % cfg.file_root,
|
||||
'tools.proxy.on':True,},
|
||||
'/static': {'tools.staticdir.on': True,
|
||||
'tools.staticdir.dir':"."},
|
||||
'/favicon.ico':{'tools.staticfile.on':True,
|
||||
'tools.staticfile.filename': "%s/static/theme/favicon.ico" % cfg.file_root}
|
||||
}
|
||||
'tools.staticfile.filename':
|
||||
"%s/static/theme/favicon.ico" % cfg.file_root}}
|
||||
cherrypy.tree.mount(cfg.html_root, '/', config=config)
|
||||
cherrypy.engine.signal_handler.subscribe()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user