[Django] #24742: Can't runserver on a read-only database due to migrations

57 views
Skip to first unread message

Django

unread,
May 3, 2015, 3:25:57 PM5/3/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+--------------------
Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
So i was handed a read only database to develop a Web API.
This is traceback when i runserver
{{{
Performing system checks...

System check identified no issues (0 silenced).
Unhandled exception in thread started by <function wrapper at 0x10ba2a848>
Traceback (most recent call last):
File "/Users/delgiudices/Dev/django/django/utils/autoreload.py", line
220, in wrapper
fn(*args, **kwargs)
File
"/Users/delgiudices/Dev/django/django/core/management/commands/runserver.py",
line 111, in inner_run
self.check_migrations()
File
"/Users/delgiudices/Dev/django/django/core/management/commands/runserver.py",
line 158, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
File "/Users/delgiudices/Dev/django/django/db/migrations/executor.py",
line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/Users/delgiudices/Dev/django/django/db/migrations/loader.py",
line 47, in __init__
self.build_graph()
File "/Users/delgiudices/Dev/django/django/db/migrations/loader.py",
line 180, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/Users/delgiudices/Dev/django/django/db/migrations/recorder.py",
line 59, in applied_migrations
self.ensure_schema()
File "/Users/delgiudices/Dev/django/django/db/migrations/recorder.py",
line 53, in ensure_schema
editor.create_model(self.Migration)
File "/Users/delgiudices/Dev/django/django/db/backends/base/schema.py",
line 284, in create_model
self.execute(sql, params or None)
File "/Users/delgiudices/Dev/django/django/db/backends/base/schema.py",
line 110, in execute
cursor.execute(sql, params)
File "/Users/delgiudices/Dev/django/django/db/backends/utils.py", line
79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/delgiudices/Dev/django/django/db/backends/utils.py", line
64, in execute
return self.cursor.execute(sql, params)
File "/Users/delgiudices/Dev/django/django/db/utils.py", line 95, in
__exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/delgiudices/Dev/django/django/db/backends/utils.py", line
62, in execute
return self.cursor.execute(sql)
File "/Users/delgiudices/Dev/django/django/db/backends/mysql/base.py",
line 124, in execute
return self.cursor.execute(query, args)
File "/Users/delgiudices/Dev/.envs/python29/lib/python2.7/site-
packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/Users/delgiudices/Dev/.envs/python29/lib/python2.7/site-
packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1142, "CREATE command denied to user
'someuser'@'someip' for table 'django_migrations'")

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24742>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 3, 2015, 3:48:32 PM5/3/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

This is a valid use case, there should be a way to support it.

This is somewhat related to #24669.

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:1>

Django

unread,
May 4, 2015, 2:02:05 AM5/4/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------

Comment (by shaib):

A workaround could be to add a router that directs all models from the
"migrations" app into some sqlite database (in fact, if it works, it could
be packed up nicely as a solution).

However, indeed, such a solution flies in the face of #24699, which
essentially asks for a migration table in each db.

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:2>

Django

unread,
May 7, 2015, 12:18:22 PM5/7/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------

Comment (by akulakov):

Adding a router that redirects migrations to a different db is exactly
what I did for a recent project, - it works just fine.

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:3>

Django

unread,
May 7, 2015, 12:32:57 PM5/7/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by akulakov):

* cc: andrei.avk@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:4>

Django

unread,
May 9, 2015, 11:09:21 AM5/9/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:5>

Django

unread,
May 9, 2015, 12:54:51 PM5/9/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+---------------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by aaugustin):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:6>

Django

unread,
May 9, 2015, 4:56:20 PM5/9/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by claudep):

* needs_better_patch: 0 => 1
* stage: Ready for checkin => Accepted


Comment:

Needs improvement as of Markus comment on the patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:7>

Django

unread,
May 11, 2015, 6:25:01 PM5/11/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+---------------------------------------------

Reporter: delgiudices | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by MarkusH):

* needs_better_patch: 1 => 0
* version: 1.8 => master


* stage: Accepted => Ready for checkin


Comment:

Patch looks good to me. FTR, I don't consider this something we should
backport, unless it's an error that didn't happen on 1.7.

PR: https://github.com/django/django/pull/4636

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:8>

Django

unread,
May 13, 2015, 12:32:39 PM5/13/15
to django-...@googlegroups.com
#24742: Can't runserver on a read-only database due to migrations
-----------------------------+---------------------------------------------
Reporter: delgiudices | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"f61c4f490dc4c8ec6ba94ad4f40247db2425fc3e" f61c4f4]:
{{{
#!CommitTicketReference repository=""
revision="f61c4f490dc4c8ec6ba94ad4f40247db2425fc3e"
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.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24742#comment:9>

Reply all
Reply to author
Forward
0 new messages