diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-19 20:32:00 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-22 11:39:18 +0100 |
| commit | d4733b6df07b1f8a869eed8eac86869d1d14472c (patch) | |
| tree | d09d2bb4e06e445fdacd62bfbea3ff4de5dbd02c | |
| parent | 4582993302262dec06a39028cc878247542c2334 (diff) | |
Not all Python modules have a __path__.
| -rw-r--r-- | django/core/apps/base.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/django/core/apps/base.py b/django/core/apps/base.py index 83c073a12a..2503d9e3ff 100644 --- a/django/core/apps/base.py +++ b/django/core/apps/base.py @@ -35,9 +35,13 @@ class AppConfig(object): self.models = None # Filesystem path to the application directory eg. - # u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. - # This is a unicode object on Python 2 and a str on Python 3. - self.path = upath(self.app_module.__path__[0]) + # u'/usr/lib/python2.7/dist-packages/django/contrib/admin'. May be + # None if the application isn't a bona fide package eg. if it's an + # egg. Otherwise it's a unicode on Python 2 and a str on Python 3. + try: + self.path = upath(self.app_module.__path__[0]) + except AttributeError: + self.path = None def __repr__(self): return '<AppConfig: %s>' % self.label |
