-
-
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: - add real multidb support for migrations - split test settings - add multi db tests and improve existing - add templates - splitout hashing - allow passing a different registry for preparation - extra names are checked - allow selecting the main database via a space character - documentation update
- Loading branch information
Showing
43 changed files
with
1,488 additions
and
211 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
import edgy | ||
|
||
_, registry = get_db_connection() | ||
registry = get_db_connection() | ||
|
||
|
||
class User(edgy.Model): | ||
|
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,46 +1,10 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
from pathlib import Path | ||
from typing import Optional, Union | ||
|
||
from my_project.utils import get_db_connection | ||
from edgy import EdgySettings | ||
|
||
from edgy import Instance, monkay | ||
from esmerald import Esmerald, Include | ||
|
||
|
||
def build_path(): | ||
""" | ||
Builds the path of the project and project root. | ||
""" | ||
Path(__file__).resolve().parent.parent | ||
SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
if SITE_ROOT not in sys.path: | ||
sys.path.append(SITE_ROOT) | ||
sys.path.append(os.path.join(SITE_ROOT, "apps")) | ||
|
||
|
||
def get_application(): | ||
""" | ||
This is optional. The function is only used for organisation purposes. | ||
""" | ||
build_path() | ||
registry = get_db_connection() | ||
|
||
app = registry.asgi( | ||
Esmerald( | ||
routes=[Include(namespace="my_project.urls")], | ||
) | ||
) | ||
|
||
monkay.set_instance( | ||
Instance( | ||
app=app, | ||
registry=registry, | ||
) | ||
) | ||
return app | ||
|
||
|
||
app = get_application() | ||
class MyMigrationSettings(EdgySettings): | ||
# here we notify about the models import path | ||
preloads: list[str] = ["myproject.apps.accounts.models"] | ||
# here we can set the databases which should be used in migrations, by default (None,) | ||
migrate_databases: Union[list[Union[str, None]], tuple[Union[str, None], ...]] = (None,) |
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
Oops, something went wrong.