Sunday, August 2, 2015

Re: Custom User Migration Error

It worked, thanks!!

On Sunday, August 2, 2015 at 2:20:07 PM UTC-4, Amitt Bhardwj wrote:
Try deleting migration folder in your app and run ./manage.py migrate

On Sun, Aug 2, 2015 at 11:45 PM,  <mdd...@gmail.com> wrote:
> Hi everyone,
>
> I've recently started adding user authentication to my app using Google's
> OAuth2. I found a sample app online
> (http://blog.jez.io/2014/10/20/using-google-apps-for-cmu-authentication/),
> tweaked it slightly for my own needs, and got it working. However, once I
> tried changing the database to MySQL (the sample was just using the default
> SQLite3), I receive this ValueError: Lookup failed for model referenced by
> field admin.LogEntry.user: myApp.CustomUser.
>
> This is the only thing that I've changed and I've scoured the internet with
> no luck. Any help would be greatly appreciated.
>
> Thank you!
>
> Here is the full stacktrace for reference:
>
> Rendering model states...Traceback (most recent call last):
>   File "manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line
> 338, in execute_from_command_line
>     utility.execute()
>   File
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line
> 330, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py",
> line 390, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py",
> line 441, in execute
>     output = self.handle(*args, **options)
>   File
> "/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py",
> line 221, in handle
>     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
>   File "/Library/Python/2.7/site-packages/django/db/migrations/executor.py",
> line 100, in migrate
>     state.apps  # Render all real_apps -- performance critical
>   File "/Library/Python/2.7/site-packages/django/utils/functional.py", line
> 60, in __get__
>     res = instance.__dict__[self.name] = self.func(instance)
>   File "/Library/Python/2.7/site-packages/django/db/migrations/state.py",
> line 166, in apps
>     return StateApps(self.real_apps, self.models)
>   File "/Library/Python/2.7/site-packages/django/db/migrations/state.py",
> line 248, in __init__
>     raise ValueError(msg.format(field=operations[0][1], model=lookup_model))
> ValueError: Lookup failed for model referenced by field admin.LogEntry.user:
> myApp.CustomUser
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c9840577-7348-4b82-8de2-17f6ab05b3f3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Everyone starts as a noob. Not everyone ends like a pro...
Amitt Bhardwj
Blog: amittbhardwj.wordpress.com
Github: https://github.com/amittbhardwj
LinkedIn: https://in.linkedin.com/in/amittbhardwj

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/64bbe681-970d-4dd4-8663-e24594b633ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment