mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
generate cherrypy.config (for now)
This commit is contained in:
parent
89972dbc0f
commit
b184fc74c5
33
plinth.py
33
plinth.py
@ -60,10 +60,43 @@ def load_modules():
|
|||||||
else:
|
else:
|
||||||
cfg.log("skipping %s" % name)
|
cfg.log("skipping %s" % name)
|
||||||
|
|
||||||
|
def write_cherrypy_config():
|
||||||
|
"""Write the cherrpy.config file.
|
||||||
|
|
||||||
|
We could just make a dict instead of writing a data file and then
|
||||||
|
reading it back, but I like the output for debugging purposes.
|
||||||
|
Future versions might do the more efficient thing.
|
||||||
|
"""
|
||||||
|
|
||||||
|
with open(os.path.join(cfg.file_root, "cherrypy.config"), 'w') as OUTF:
|
||||||
|
OUTF.write(
|
||||||
|
"""### Generated file, do not edit! ###
|
||||||
|
|
||||||
|
[global]
|
||||||
|
server.socket_host = '0.0.0.0'
|
||||||
|
server.socket_port = 8000
|
||||||
|
server.thread_pool = 10
|
||||||
|
tools.staticdir.root = "{fileroot}"
|
||||||
|
tools.sessions.on = True
|
||||||
|
tools.auth.on = True
|
||||||
|
tools.sessions.storage_type = "file"
|
||||||
|
tools.sessions.timeout = 90
|
||||||
|
tools.sessions.storage_path = "{fileroot}/data/cherrypy_sessions"
|
||||||
|
|
||||||
|
[/static]
|
||||||
|
tools.staticdir.on = True
|
||||||
|
tools.staticdir.dir = "static"
|
||||||
|
|
||||||
|
[/favicon.ico]
|
||||||
|
tools.staticfile.on = True
|
||||||
|
tools.staticfile.filename = "{fileroot}/static/theme/favicon.ico"
|
||||||
|
""".format(fileroot=cfg.file_root))
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
os.chdir(cfg.file_root)
|
os.chdir(cfg.file_root)
|
||||||
cherrypy.config.update({'error_page.404': error_page_404})
|
cherrypy.config.update({'error_page.404': error_page_404})
|
||||||
cherrypy.config.update({'error_page.500': error_page_500})
|
cherrypy.config.update({'error_page.500': error_page_500})
|
||||||
|
write_cherrypy_config()
|
||||||
cfg.log = Logger()
|
cfg.log = Logger()
|
||||||
load_modules()
|
load_modules()
|
||||||
cfg.html_root = Root()
|
cfg.html_root = Root()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user