I have the following error when I try to start my local development server:
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 199, in get_model
self.check_models_ready()
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 131, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
So I searched SO for an answer and came across this relevant post that looks the best avenue for me.
The accepted answer states that:
The solution was to add these lines at the beginning of my program:
import django
django.setup()
I have no idea how or where I should add these two lines to my code so that the lines are at the beginning of my program. I have searched SO & Google, but could not solve this issue.
I am hoping that someone can easily explain to me exactly where I should add the two lines of code so that they are at the beginning of my program. I am really unsure where the beginning of my code / program officially is.
EDIT
This is the contents of my wsgi.py file:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "globalx.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()