mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Add a system check on CI to catch missing migrations
This commit is contained in:
parent
0e5316505b
commit
bed5c802df
|
@ -27,6 +27,7 @@ matrix:
|
|||
- { python: "3.8", env: TOXENV=base }
|
||||
- { python: "3.8", env: TOXENV=lint }
|
||||
- { python: "3.8", env: TOXENV=docs }
|
||||
- { python: "3.8", env: TOXENV=checks }
|
||||
|
||||
- python: "3.8"
|
||||
env: TOXENV=dist
|
||||
|
|
29
runchecks.py
Executable file
29
runchecks.py
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Basic script used to run django-admin checks in CI/tox."""
|
||||
from django.conf import settings
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Minimal settings required to check for migrations
|
||||
settings.configure(
|
||||
SECRET_KEY = "not very secret in checks either",
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": ":memory:"
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
"rest_framework.authtoken"
|
||||
]
|
||||
)
|
||||
|
||||
print("Running basic Django system checks")
|
||||
execute_from_command_line(["manage.py", "check"])
|
||||
|
||||
print("Checking for missing Django migrations")
|
||||
execute_from_command_line(["manage.py", "makemigrations", "--dry-run", "--verbosity=3", "--check"])
|
Loading…
Reference in New Issue
Block a user