Hi,
Don't import models in models.py since at point of import there is no
guarantee that model is actually registered, and thus you get the exception.
To fix the issue use string format to refer models in other apps. In
your case instead of importing model and doing the following:
token = models.ForeignKey(Token)
You should do (check app name, I just guessed it):
token = models.ForeignKey('authtoken.Token')
(and remove the import all thogether)
On 30.01.2017 10:50, Soham Navadiya wrote:
I have upgraded django 1.7 to 1.9.12 and django-rest-framework 3.5.3
I am getting below error stack after running the server.
I have tried to apply various thing. but It doesn't help.
How can I solve this?
|File "/home/soham/Documents/upg/rest_api/api/models.py", line 7, in
<module> from rest_framework.authtoken.models import Token File
"/home/soham/Documents/upg/rest_api/cubii_d_u/local/lib/python2.7/site-packages/rest_framework/authtoken/models.py",
line 11, in <module> class Token(models.Model): File
"/home/soham/Documents/upg/rest_api/cubii_d_u/local/lib/python2.7/site-packages/django/db/models/base.py",
line 94, in __new__ app_config =
apps.get_containing_app_config(module) File
"/home/soham/Documents/upg/rest_api/cubii_d_u/local/lib/python2.7/site-packages/django/apps/registry.py",
line 239, in get_containing_app_config self.check_apps_ready() File
"/home/soham/Documents/upg/rest_api/cubii_d_u/local/lib/python2.7/site-packages/django/apps/registry.py",
line 124, in check_apps_ready raise AppRegistryNotReady("Apps aren't
loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't
loaded yet.|
--
You received this message because you are subscribed to the Google
Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
Jani Tiainen
--
You received this message because you are subscribed to the Google Groups "Django
REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.