summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-05-09 17:01:40 +0200
committerClaude Paroz <claude@2xlibre.net>2015-05-13 18:30:36 +0200
commitf61c4f490dc4c8ec6ba94ad4f40247db2425fc3e (patch)
tree8ce61422333b0b4fb850a13b1f776f0024bd0d1d /django/core
parent3c8fe5dddf34533a419d2deed5208a28de32cb4a (diff)
Fixed #24742 -- Made runserver.check_migrations ignore read-only databases
Thanks Luis Del Giudice for the report, and Aymeric Augustin and Markus Holtermann for the reviews.
Diffstat (limited to 'django/core')
-rw-r--r--django/core/management/commands/runserver.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
index e2d447147b..700da7f31d 100644
--- a/django/core/management/commands/runserver.py
+++ b/django/core/management/commands/runserver.py
@@ -12,6 +12,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp import get_internal_wsgi_application, run
from django.db import DEFAULT_DB_ALIAS, connections
+from django.db.migrations.exceptions import MigrationSchemaMissing
from django.db.migrations.executor import MigrationExecutor
from django.utils import autoreload, six
from django.utils.encoding import force_text, get_system_encoding
@@ -109,10 +110,7 @@ class Command(BaseCommand):
self.stdout.write("Performing system checks...\n\n")
self.check(display_num_errors=True)
- try:
- self.check_migrations()
- except ImproperlyConfigured:
- pass
+ self.check_migrations()
now = datetime.now().strftime('%B %d, %Y - %X')
if six.PY2:
now = now.decode(get_system_encoding())
@@ -157,7 +155,17 @@ class Command(BaseCommand):
Checks to see if the set of migrations on disk matches the
migrations in the database. Prints a warning if they don't match.
"""
- executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
+ try:
+ executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
+ except ImproperlyConfigured:
+ # No databases are configured (or the dummy one)
+ return
+ except MigrationSchemaMissing:
+ self.stdout.write(self.style.NOTICE(
+ "\nNot checking migrations as it is not possible to access/create the django_migrations table."
+ ))
+ return
+
plan = executor.migration_plan(executor.loader.graph.leaf_nodes())
if plan:
self.stdout.write(self.style.NOTICE(