[Django] #27114: Migrations: AttributeError: can't set attribute

62 views
Skip to first unread message

Django

unread,
Aug 23, 2016, 12:03:39 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
----------------------------+--------------------------------------------
Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Keywords: AttributeError Migrations 1.10
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------------
I just updated to Django 1.10 from Django 1.9.9, and when I ran my server
it told me I needed to migrate due to a change in auth. When I ran
manage.py migrate, I get the following error:

{{{
vagrant@vagrant-box:~/website$ python manage.py migrate
System check identified some issues:

WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection
'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in
MySQL, such as data truncation upon insertion, by escalating warnings into
errors. It is strongly recommended you activate it. See:
https://docs.djangoproject.com/en/1.10/ref/databases/#mys
ql-sql-mode
myapp.MyModel.my_field: (fields.W901) CommaSeparatedIntegerField has been
deprecated. Support for it (except in historical migrations) will be
removed in Django 2.0.
HINT: Use
CharField(validators=[validate_comma_separated_integer_list]) instead.
Operations to perform:
Apply all migrations: [...]
Running migrations:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 367, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 356, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/migrate.py", line 202, in handle
targets, plan, fake=fake, fake_initial=fake_initial
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 97, in migrate
state = self._migrate_all_forwards(plan, full_plan, fake=fake,
fake_initial=fake_initial)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 138, in
_migrate_all_forwards
migration.mutate_state(state, preserve=False)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/migration.py", line 92, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/operations/models.py", line 733, in
state_forwards
state.reload_model(app_label, self.name_lower)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 162, in reload_model
self.apps.render_multiple(states_to_be_rendered)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 277, in render_multiple
model.render(self)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/state.py", line 559, in render
body,
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py",
line 157, in __new__
new_class.add_to_class(obj_name, obj)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py",
line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib/python2.7/dist-
packages/django/db/models/manager.py", line 120, in contribute_to_class
setattr(model, name, ManagerDescriptor(self))
AttributeError: can't set attribute
}}}

As far as I could tell, the code in the stack trace is all Django code, so
I don't think it's a bad site package. Is it possible that something in
my code needs to change to prevent this error, or is this a Django bug?
Thanks.

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

Django

unread,
Aug 23, 2016, 12:27:11 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------

Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Can you provide a minimal project that reproduces the issue? We can't do
much to diagnose the issue based on the stacktrace alone.

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

Django

unread,
Aug 23, 2016, 1:16:00 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------

Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by sweaver360):

Replying to [comment:1 timgraham]:


> Can you provide a minimal project that reproduces the issue? We can't do
much to diagnose the issue based on the stacktrace alone.

I'm guessing it won't happen if I just start a new Django 1.10 project
since no one else is reporting the issue, which makes me think it's
probably something in my project. Is there any way to find out which
migration is causing the exception? It's hard to tell what's going on
with it only referencing core Django files in the stack trace.

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

Django

unread,
Aug 23, 2016, 1:32:49 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------

Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by timgraham):

You can edit `/usr/local/lib/python2.7/dist-
packages/django/db/models/manager.py` and add some print statements to see
the relevant model that's causing the exception. The idea of a minimal
project would be to strip down your current project to something that you
can share.

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

Django

unread,
Aug 23, 2016, 2:03:26 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------

Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by claudep):

There was a similar error with django-mptt <= 0.8.5, are you using django-
mptt or any other third party app?

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

Django

unread,
Aug 23, 2016, 2:12:38 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------

Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by sweaver360):

Replying to [comment:4 claudep]:


> There was a similar error with django-mptt <= 0.8.5, are you using

django-mptt or any other third party app?

Thanks for the help, it looks like the issue is django-mptt. I just
upgraded to 0.8.6 (I was unable to even run a server when I was on 0.8.5).
When I added print statements to django/db/models/manager.py, the model
causing the issue is my model that inherits from MPTTModel. I'll follow
up with them to work through this issue.

Thanks again.

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

Django

unread,
Aug 23, 2016, 2:13:14 PM8/23/16
to django-...@googlegroups.com
#27114: Migrations: AttributeError: can't set attribute
-------------------------------------+-------------------------------------
Reporter: sweaver360 | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.10
Severity: Normal | Resolution: invalid

Keywords: AttributeError | Triage Stage:
Migrations 1.10 | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


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

Reply all
Reply to author
Forward
0 new messages