Django error - no module named
Posted
by
Shreyas
on Stack Overflow
See other posts from Stack Overflow
or by Shreyas
Published on 2012-09-05T15:19:16Z
Indexed on
2012/09/05
15:38 UTC
Read the original article
Hit count: 317
Here is my relevant directory structure (Windows 7, Python 2.7, virtualenv)
-userProf
- - manage.py
- -UserProfile
- sampleapp_db
- urls.py
- views.py
- wsgi.py
- __init__.py
-
-libs
- - __init__.py
- -allauth
- - app_settings.py
- - models.py
- - tests.py
- - urls.py
- - utils.py
- -
- -account
- - - admin.py
- - - context_processors.py
- - - models.py
- - - urls.py
- - - __init__.py
- -socialaccount
- - - admin.py
- - - context_processors.py
- - - models.py
- - - urls.py
- - - views.py
- - - __init__.py
- - -
- -templates
- -account
- - - base.html
- - - email.html
-settings
- base_settings.py
- dev.py
- __init__.py
-
-static
-css
I get the following error when I try to run this dango app Error: No module named account
I have read other posts on SO that refer to the syspath being the issue or that the appname matches the project name
Django Shell No module named settings
...as a result of this, I added the following statements in the base_settings.py file
import sys
base = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
base_parent = os.path.dirname(base)
sys.path.append(base)
sys.path.append(base_parent)
sys.path.append(os.path.join(base,'libs'))
sys.path.append(os.path.join(base,'libs','allauth','account'))
I verified that the sys.path is correct by putting a break in PyCharm and evaluating sys.path
Should I be putting this in manage.py?
Some other SO postings referred to not being able to import the module but I can launch the python console and import UserProfile.libs.allauth.account without any exceptions being thrown!
My base_setings.py has the following relevant section
INSTALLED_APPS = (
'UserProfile.libs.allauth.account',
)
© Stack Overflow or respective owner