Skip to content
Advertisement

“Models aren’t loaded yet” error while populating in Django 1.8 or later

I am using this code to populate my database:

JavaScript

On running

JavaScript

It gives the error:

JavaScript

Rest of my files are ok but getting this error. I am following the tutorial from Tango with Django book but as the book refers to Django 1.5.4 and i am using Django 1.8, so can anyone help me here?

Advertisement

Answer

I had the same exception with Django 1.7rc2. The solution was to add these lines at the beginning of my program:

JavaScript

Update: This is now documented for Django 1.8.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement