-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - improve connection docs - test harder that the not connected warnings are appropiate.
- Loading branch information
Showing
7 changed files
with
168 additions
and
43 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
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
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
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,15 @@ | ||
from edgy import Registry, Instance, monkay | ||
|
||
models = Registry(database="sqlite:///db.sqlite", echo=True) | ||
|
||
|
||
async def main(): | ||
# check if settings are loaded | ||
monkay.evaluate_settings_once(ignore_import_errors=False) | ||
# monkey-patch app so you can use edgy shell | ||
monkay.set_instance(Instance(app=app, registry=registry)) | ||
await models.__aenter__() | ||
try: | ||
... | ||
finally: | ||
await models.__aexit__() |
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,17 @@ | ||
from contextlib import asynccontextmanager | ||
from esmerald import Esmerald | ||
|
||
from edgy import Registry, Instance, monkay | ||
|
||
models = Registry(database="sqlite:///db.sqlite", echo=True) | ||
|
||
|
||
app = Esmerald( | ||
routes=[...], | ||
on_startup=[models.__aenter__], | ||
on_shutdown=[models.__aexit__], | ||
) | ||
# check if settings are loaded | ||
monkay.evaluate_settings_once(ignore_import_errors=False) | ||
# monkey-patch app so you can use edgy shell | ||
monkay.set_instance(Instance(app=app, registry=registry)) |
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
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