Reputation: 5511
There are numerous similar questions here on SO, but they all seem to be for older versions, or are related to a typo.
In part 2 of the Django 1.9 tutorial, I am stuck at the initial migration for the polls app:
python manage.py makemigrations polls
When running this, I get the error: `ImportError: No module named 'polls.apps'
I am using Python 3.5.1
and Django 1.9.4
excerpt from mysite/settings.py
...
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
...
Folder structure:
.
├── db.sqlite3
├── manage.py
├── mysite
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── __pycache__
│ ├── settings.py
│ ├── settings.pyc
│ ├── urls.py
│ └── wsgi.py
└── polls
├── __init__.py
├── __pycache__
├── admin.py
├── models.py
├── tests.py
├── urls.py
└── views.py
4 directories, 21 files
Upvotes: 3
Views: 8839
Reputation: 1
Please verify which python do you use: python2 or python3.
$ python --version
Python 2.7.6
$ python3 --version
Python 3.4.3
After switching the alias to python3 and re-running the tutorial, I got the missing file polls/apps.py
(which contains the class PollsConfig
).
Upvotes: 0
Reputation: 1
yes! the settings.py file should contain...
INSTALLED_APPS = (
'polls',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
The tutorial is so frustrating to follow with errors and inexplicable statements: With Windows, you can't use TimeZone so just use the system timezone. Er,...how?? You just have to set it to None, i.e.:
TIME_ZONE = None # for Windows!! Was: 'UTC' for Chicago
USE_I18N = True
USE_L10N = True
USE_TZ = False ## just use Windows system time
Hope this helps someone.
Upvotes: 0
Reputation: 474001
You are missing the apps.py
file (and the polls.migrations
package also) which should have been generated on this step: Creating the Polls app. Please review to ensure you've completed that step correctly.
Upvotes: 7
Reputation: 166
What about if you replace
INSTALLED_APPS = [
'polls.apps.PollsConfig',
...
]
by just
INSTALLED_APPS = [
'polls',
...
]
Upvotes: 5