Thursday, May 31, 2018

Re: dumpdata fails with crytpic error

On 1/06/2018 2:22 PM, Bernd Wechner wrote:
> Just tried this:
>
> |
> $ python3 manage.py dumpdata --format json --indent 4>data.json
> CommandError:Unableto serialize database:'NoneType'objecthas
> noattribute 'is_authenticated'
> |
>
> Anyone seen this before. How does one diagnose this given the vague
> nature of the message? I mean I presume it's complaining because
> there's an illegal value in a field in the database. But you think
> it's mention which field in which model on which record? Is there a
> quick way to find out?

I haven't seen it before but I would say it is your user model.
is_authenticated is an attribute of django.contrib.auth.user (actually
AbstractUser I think).

Don't know whether --verbosity=2 would give you more error info.

Here is mine which does work ...

python manage.py dumpdata --settings=proj.settings.dev --indent=2
--verbosity=0 --natural-primary --natural-foreign --all > dump.json

Note the settings arg which is required for manage.py to find the
correct database if you don't have DJANGO_SETTINGS_MODULE established in
your environment.

Mike

>
> Regards,
>
> Bernd.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/32b8f2a7-cbe2-420d-baee-5101e00a7038%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/32b8f2a7-cbe2-420d-baee-5101e00a7038%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3d810e88-9ebb-cb5f-416d-4d0e82c023c9%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment