mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-17 11:10:23 +00:00
write cherrypy.config if needed
This commit is contained in:
parent
2288b7804a
commit
500a8f1e79
27
plinth.py
27
plinth.py
@ -7,6 +7,33 @@ import cfg
|
||||
if not os.path.join(cfg.file_root, "vendor") in sys.path:
|
||||
sys.path.append(os.path.join(cfg.file_root, "vendor"))
|
||||
|
||||
|
||||
def write_cherrypy_config_if_needed():
|
||||
"""If there is no cherrpy.config, write one."""
|
||||
if not os.path.exists(os.path.join(cfg.file_root, "cherrypy.config")):
|
||||
with open(os.path.join(cfg.file_root, "cherrypy.config"), 'w') as OUTF:
|
||||
OUTF.write("""
|
||||
[global]
|
||||
server.socket_host = '0.0.0.0'
|
||||
server.socket_port = 8000
|
||||
server.thread_pool = 10
|
||||
tools.staticdir.root = "%(file_root)s"
|
||||
tools.sessions.on = True
|
||||
tools.auth.on = True
|
||||
tools.sessions.storage_type = "file"
|
||||
tools.sessions.timeout = 90
|
||||
tools.sessions.storage_path = "%(data_dir)s/cherrypy_sessions"
|
||||
|
||||
[/static]
|
||||
tools.staticdir.on = True
|
||||
tools.staticdir.dir = "static"
|
||||
|
||||
[/favicon.ico]
|
||||
tools.staticfile.on = True
|
||||
tools.staticfile.filename = "%(file_root)s/static/theme/favicon.ico"
|
||||
""" % {'data_dir':cfg.data_dir, 'file_root':cfg.file_root})
|
||||
|
||||
write_cherrypy_config_if_needed()
|
||||
import cherrypy
|
||||
from cherrypy import _cpserver
|
||||
from cherrypy.process.plugins import Daemonizer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user