-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from uclahs-cds/aholmes-polish-web-and-db
Add checks to determine whether "create" and "modify" can safely run
- Loading branch information
Showing
4 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 18 additions & 15 deletions
33
src/web/BL_Python/web/scaffolding/templates/base/{{application_name}}/__init__.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
application_configs = [] | ||
application_modules = [] | ||
from {{application_name}}._version import __version__ | ||
|
||
{% if 'database' in module %} | ||
from BL_Python.database.config import DatabaseConfig | ||
from BL_Python.database.dependency_injection import ScopedSessionModule | ||
application_configs.append(DatabaseConfig) | ||
application_modules.append(ScopedSessionModule()) | ||
{% endif %} | ||
def create_app(): | ||
application_configs = [] | ||
application_modules = [] | ||
|
||
from BL_Python.web.application import create_app | ||
# fmt: off | ||
app = create_app( | ||
application_configs=application_configs, | ||
application_modules=application_modules | ||
) | ||
# fmt: on | ||
{% if 'database' in module %} | ||
from BL_Python.database.config import DatabaseConfig | ||
from BL_Python.database.dependency_injection import ScopedSessionModule | ||
application_configs.append(DatabaseConfig) | ||
application_modules.append(ScopedSessionModule()) | ||
{% endif %} | ||
|
||
from BL_Python.web.application import create_app as _create_app | ||
# fmt: off | ||
return _create_app( | ||
application_configs=application_configs, | ||
application_modules=application_modules | ||
) | ||
# fmt: on |
5 changes: 3 additions & 2 deletions
5
src/web/BL_Python/web/scaffolding/templates/base/{{application_name}}/__main__.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from __init__ import app | ||
from __init__ import create_app | ||
|
||
app.run() | ||
if __name__ == '__main__': | ||
create_app().run() |
4 changes: 4 additions & 0 deletions
4
src/web/BL_Python/web/scaffolding/templates/base/{{application_name}}/_version.py.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import importlib.metadata | ||
|
||
__version__ = importlib.metadata.version(__package__ or __name__) | ||
__bl_python_scaffold__ = True |