Skip to content

AppRegistryNotReady error with parsemail.py #15

@y2kenny

Description

@y2kenny

Using Django 1.9.1

When piping a mail to the parsemail.sh I get the following error.

Looks like it can be fixed by placing "django.setup()" immediately after "import django" instead of at the beginning of main()

Traceback (most recent call last):
  File "/home/yuho/git/patchwork/patchwork/bin/parsemail.py", line 38, in <module>
    from django.contrib.auth.models import User
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 4, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 94, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 239, in get_containing_app_config
    self.check_apps_ready()
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions