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:
Sunil Mohan Adapa authored and James Valleroy committed 2020-06-28 21:01:55 -04:00
1 parent 91c4d6742e
commit 28fe8c8c3e
2 files changed
+4

No files matched your search

+3
View File
@@ -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)