mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
allow modules to have custom static directories
This commit is contained in:
parent
27287097c5
commit
57ba43cfc9
@ -29,6 +29,8 @@ import cfg
|
|||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
loaded_modules = []
|
||||||
|
|
||||||
|
|
||||||
def load_modules():
|
def load_modules():
|
||||||
"""
|
"""
|
||||||
@ -71,6 +73,7 @@ def load_modules():
|
|||||||
|
|
||||||
for module_name in ordered_modules:
|
for module_name in ordered_modules:
|
||||||
_initialize_module(modules[module_name])
|
_initialize_module(modules[module_name])
|
||||||
|
loaded_modules.append(module_name)
|
||||||
|
|
||||||
|
|
||||||
def _insert_modules(module_name, module, remaining_modules, ordered_modules):
|
def _insert_modules(module_name, module, remaining_modules, ordered_modules):
|
||||||
|
|||||||
13
plinth.py
13
plinth.py
@ -104,6 +104,19 @@ def setup_server():
|
|||||||
'tools.staticdir.dir': '.'}}
|
'tools.staticdir.dir': '.'}}
|
||||||
cherrypy.tree.mount(None, django.conf.settings.STATIC_URL, config)
|
cherrypy.tree.mount(None, django.conf.settings.STATIC_URL, config)
|
||||||
|
|
||||||
|
# TODO: our modules are mimicking django apps. It'd be better to convert
|
||||||
|
# our modules to django apps instead of reinventing the wheel.
|
||||||
|
# (we'll still have to serve the static files with cherrypy though)
|
||||||
|
for module in module_loader.loaded_modules:
|
||||||
|
staticdir = os.path.join(cfg.file_root, 'modules', module, 'static')
|
||||||
|
if os.path.isdir(staticdir):
|
||||||
|
config = {
|
||||||
|
'/': {'tools.staticdir.root': staticdir,
|
||||||
|
'tools.staticdir.on': True,
|
||||||
|
'tools.staticdir.dir': '.'}}
|
||||||
|
urlprefix = "%s%s" % (django.conf.settings.STATIC_URL, module)
|
||||||
|
cherrypy.tree.mount(None, urlprefix, config)
|
||||||
|
|
||||||
if not cfg.no_daemon:
|
if not cfg.no_daemon:
|
||||||
Daemonizer(cherrypy.engine).subscribe()
|
Daemonizer(cherrypy.engine).subscribe()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user