mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
customization: Serve static files from customization directory
- Static files are directly served by the CherryPy web server. - .gitignore file placed as a placeholder to be able to commit the directory Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
8c89756b63
commit
9721eeac2b
@ -7,6 +7,7 @@ log_dir = /var/log/plinth
|
|||||||
server_dir = /plinth
|
server_dir = /plinth
|
||||||
actions_dir = /usr/share/plinth/actions
|
actions_dir = /usr/share/plinth/actions
|
||||||
doc_dir = /usr/share/doc/plinth
|
doc_dir = /usr/share/doc/plinth
|
||||||
|
custom_static_dir = /var/www/plinth/custom/static
|
||||||
|
|
||||||
# file locations
|
# file locations
|
||||||
store_file = %(data_dir)s/plinth.sqlite3
|
store_file = %(data_dir)s/plinth.sqlite3
|
||||||
|
|||||||
1
data/var/www/plinth/custom/static/theme
Symbolic link
1
data/var/www/plinth/custom/static/theme
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
themes/default/
|
||||||
5
data/var/www/plinth/custom/static/themes/default/icons/.gitignore
vendored
Normal file
5
data/var/www/plinth/custom/static/themes/default/icons/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
||||||
|
|
||||||
@ -7,6 +7,7 @@ log_dir = %(file_root)s/data/var/log/plinth
|
|||||||
server_dir = /plinth
|
server_dir = /plinth
|
||||||
actions_dir = %(file_root)s/actions
|
actions_dir = %(file_root)s/actions
|
||||||
doc_dir = %(file_root)s/doc
|
doc_dir = %(file_root)s/doc
|
||||||
|
custom_static_dir = %(file_root)s/data/var/www/plinth/custom/static
|
||||||
|
|
||||||
# file locations
|
# file locations
|
||||||
store_file = %(data_dir)s/plinth.sqlite3
|
store_file = %(data_dir)s/plinth.sqlite3
|
||||||
|
|||||||
@ -112,6 +112,19 @@ def setup_server():
|
|||||||
logger.debug('Serving static directory %s on %s', static_dir,
|
logger.debug('Serving static directory %s on %s', static_dir,
|
||||||
django.conf.settings.STATIC_URL)
|
django.conf.settings.STATIC_URL)
|
||||||
|
|
||||||
|
custom_static_dir = cfg.custom_static_dir
|
||||||
|
custom_static_url = '/plinth/custom/static'
|
||||||
|
config = {
|
||||||
|
'/': {
|
||||||
|
'tools.staticdir.root': custom_static_dir,
|
||||||
|
'tools.staticdir.on': True,
|
||||||
|
'tools.staticdir.dir': '.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cherrypy.tree.mount(None, custom_static_url, config)
|
||||||
|
logger.debug('Serving custom static directory %s on %s', custom_static_dir,
|
||||||
|
custom_static_url)
|
||||||
|
|
||||||
js_dir = '/usr/share/javascript'
|
js_dir = '/usr/share/javascript'
|
||||||
js_url = '/javascript'
|
js_url = '/javascript'
|
||||||
config = {
|
config = {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ root = None
|
|||||||
file_root = None
|
file_root = None
|
||||||
config_dir = None
|
config_dir = None
|
||||||
data_dir = None
|
data_dir = None
|
||||||
|
custom_static_dir = None
|
||||||
store_file = None
|
store_file = None
|
||||||
actions_dir = None
|
actions_dir = None
|
||||||
doc_dir = None
|
doc_dir = None
|
||||||
@ -81,10 +82,9 @@ def read(config_path=None, root_directory=None):
|
|||||||
global config_file # pylint: disable-msg=invalid-name,global-statement
|
global config_file # pylint: disable-msg=invalid-name,global-statement
|
||||||
config_file = config_path
|
config_file = config_path
|
||||||
|
|
||||||
parser = configparser.ConfigParser(
|
parser = configparser.ConfigParser(defaults={
|
||||||
defaults={
|
'root': os.path.realpath(root_directory),
|
||||||
'root': os.path.realpath(root_directory),
|
})
|
||||||
})
|
|
||||||
parser.read(config_file)
|
parser.read(config_file)
|
||||||
|
|
||||||
config_items = (
|
config_items = (
|
||||||
@ -92,6 +92,7 @@ def read(config_path=None, root_directory=None):
|
|||||||
('Path', 'file_root', 'string'),
|
('Path', 'file_root', 'string'),
|
||||||
('Path', 'config_dir', 'string'),
|
('Path', 'config_dir', 'string'),
|
||||||
('Path', 'data_dir', 'string'),
|
('Path', 'data_dir', 'string'),
|
||||||
|
('Path', 'custom_static_dir', 'string'),
|
||||||
('Path', 'store_file', 'string'),
|
('Path', 'store_file', 'string'),
|
||||||
('Path', 'actions_dir', 'string'),
|
('Path', 'actions_dir', 'string'),
|
||||||
('Path', 'doc_dir', 'string'),
|
('Path', 'doc_dir', 'string'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user