mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
web_framework: Split initialization into two parts
A simple Django configuration does not need to create the database whereas DB migration requires creating the database. In some operations such as listing dependencies, we can skip running the second part and so writing to database will no longer be necessary during such operations. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
91c4d6742e
commit
28fe8c8c3e
@ -132,6 +132,7 @@ def main():
|
||||
log.init()
|
||||
|
||||
web_framework.init()
|
||||
web_framework.post_init()
|
||||
|
||||
logger.info('FreedomBox Service (Plinth) version - %s', __version__)
|
||||
for config_file in cfg.config_files:
|
||||
|
||||
@ -53,6 +53,9 @@ def init():
|
||||
logger.debug('Configured Django with applications - %s',
|
||||
settings.INSTALLED_APPS)
|
||||
|
||||
|
||||
def post_init():
|
||||
"""Perform operations after completing init of other modules."""
|
||||
logger.debug('Creating or adding new tables to data file')
|
||||
django.core.management.call_command('migrate', '--fake-initial',
|
||||
interactive=False, verbosity=0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user