I've got a basic Django site up and running and am now trying to write a 
custom command by following the "Writing custom django-admin commands" 
documentation.  However having followed it carefully I get this exception:

(myfrontier) C:\Users\PDS\git\myfrontier>set 
DJANGO_SETTINGS_MODULE=myfrontier.settings

(myfrontier) C:\Users\PDS\git\myfrontier>django-admin podcasts
Traceback (most recent call last):
  File "C:\virtualenv\myfrontier\Scripts\django-admin-script.py", line 11, 
in <module>
    load_entry_point('Django', 'console_scripts', 'django-admin')()
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\core\management\__init__.py",
 
line 381, in execute_from_command_line
    utility.execute()
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\core\management\__init__.py",
 
line 357, in execute
    django.setup()
  File "C:\virtualenv\myfrontier\lib\site-packages\django\__init__.py", 
line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\apps\registry.py", line 
91, in populate
    app_config = AppConfig.create(entry)
  File "C:\virtualenv\myfrontier\lib\site-packages\django\apps\config.py", 
line 90, in create
    module = import_module(entry)
  File "C:\virtualenv\myfrontier\lib\importlib\__init__.py", line 126, in 
import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
  File "c:\users\pds\git\myfrontier\portal\management\podcasts.py", line 2, 
in <module>
    from portal.models import ShowEpisode
  File "c:\users\pds\git\myfrontier\portal\models.py", line 4, in <module>
    class Dir(models.Model):
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\db\models\base.py", line 
103, in __new__
    app_config = apps.get_containing_app_config(module)
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\apps\registry.py", line 
252, in get_containing_app_config
    self.check_apps_ready()
  File 
"C:\virtualenv\myfrontier\lib\site-packages\django\apps\registry.py", line 
135, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

The first two lines of my custom command are just like the example in the 
doc...
from django.core.management.base import BaseCommand, CommandError
from portal.models import ShowEpisode

So what am I doing wrong?  Is the documentation just wrong?  A quick Google 
throws up lots of suggestions and a number of people hitting this so can 
someone from Django dev. give some proper chapter and verse on how to solve 
this please?

thanks,
Paul DS

-- 
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+unsubscr...@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/f10ff11c-e954-449b-a156-59953fc836da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to