-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add startup check and support postgres (#10)
* Add startup check, support postgres * Fix the version
- Loading branch information
1 parent
49f5e96
commit 6d6df16
Showing
3 changed files
with
32 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django import VERSION | ||
from django.core.checks import Error, register, Tags | ||
from django.conf import settings | ||
|
||
|
||
# pylint: disable=unused-argument | ||
@register(Tags.compatibility) | ||
def odin_startup_check(app_configs, **kwargs): | ||
errors = [] | ||
|
||
django_major_version = VERSION[0] | ||
|
||
if django_major_version < 4: | ||
for _, database in settings.DATABASES.items(): | ||
if database["ENGINE"] == "django.db.backends.sqlite3": | ||
errors.append( | ||
Error( | ||
"django-oscar-odin does not support sqlite3 with Django < 4. Please use engines that have can_return_rows_from_bulk_insert set to True (like Postgres) or upgrade your Django version to 4 or higher.", | ||
id="django-oscar-odin.E001", | ||
) | ||
) | ||
|
||
return errors |
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