mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-18 09:10:49 +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__)
|
||||
|
||||
loaded_modules = []
|
||||
|
||||
|
||||
def load_modules():
|
||||
"""
|
||||
@ -71,6 +73,7 @@ def load_modules():
|
||||
|
||||
for module_name in ordered_modules:
|
||||
_initialize_module(modules[module_name])
|
||||
loaded_modules.append(module_name)
|
||||
|
||||
|
||||
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': '.'}}
|
||||
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:
|
||||
Daemonizer(cherrypy.engine).subscribe()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user