163👍
The first problem is this warning in the traceback:
No module named 'polls.apps.PollsConfigdjango'
That means that you are missing a comma after 'polls.apps.PollsConfig
in your INSTALLED_APPS
setting. It should be:
INSTALLED_APPS = (
...
'polls.apps.PollsConfig',
'django....',
...
)
The second problem is the warning 'polls.apps' is not a package
. That suggests that you have installed Django 1.8, but you are following the Django 1.9 tutorial.
If you are using Django 1.8, then follow the 1.8 tutorial so that you don’t hit problems like this. Adding the polls app to INSTALLED_APPS
is covered here in the Django 1.8 tutorial. Note that it doesn’t use PollsConfig
.
INSTALLED_APPS = (
...
'polls',
)
44👍
ImportError: No module named 'polls.apps.PollsConfigdjango'
You forgot to add ‘,’ in the list
- [Django]-Django: using <select multiple> and POST
- [Django]-Django: Assigning variables in template
- [Django]-Disable migrations when running unit tests in Django 1.7
- [Django]-Making a Django form class with a dynamic number of fields
- [Django]-Django REST Framework: how to substitute null with empty string?
- [Django]-Why is assertDictEqual needed if dicts can be compared by `==`?
14👍
You just missed a comma after 'polls.apps.PollsConfig'
.
Don’t worry, it happens for the best of us!
- [Django]-No module named urllib.parse (How should I install it?)
- [Django]-How do you insert a template into another template?
- [Django]-Custom error messages in Django Rest Framework serializer
12👍
Anyone who is getting
ModuleNotFoundError: No module named ‘pollsdjango’
And INSTALLED_APPS :
INSTALLED_APPS = [
'polls.apps.PollsConfig'
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
Solution:
You forgot to add comma(,) at the end of line ‘polls.apps.PollsConfig’
INSTALLED_APPS = [
'polls.apps.PollsConfig', <----this comma
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
- [Django]-Coverage.py warning: No data was collected. (no-data-collected)
- [Django]-Test sending email without email server
- [Django]-Testing admin.ModelAdmin in django
4👍
Quoted from https://code.djangoproject.com/ticket/27139
Description
In tutorial 02, Writing your first Django app, part 2, typing in
INSTALLED_APPS = [
'polls.apps.PollsConfig',
....
will cause an ImportError: No module named ‘polls.apps.PollsConfig’; ‘polls.apps’ is not a package
This is resolved by instead putting
INSTALLED_APPS = [
'polls',
....
- [Django]-Django rest framework serializing many to many field
- [Django]-Django Admin linking to related objects
- [Django]-How to read the database table name of a Model instance?
3👍
I was getting a similar error: ImportError: No module named ‘polls’
The cause was that I stored my apps inside the “apps” directory.
The solution is to change the code inside apps.py
from:
class PollsConfig(AppConfig):
name = 'polls'
to (“apps” is the name of my django apps directory):
class PollsConfig(AppConfig):
name = 'apps.polls'
- [Django]-URL-parameters and logic in Django class-based views (TemplateView)
- [Django]-Passing Python Data to JavaScript via Django
- [Django]-Django: return string from view
2👍
you forget to add "," after ‘polls.apps.PollsConfig’ ","
must include a comma "," … ‘polls.apps.PollsConfig’,
- [Django]-Django filter the model on ManyToMany count?
- [Django]-Django optional URL parameters
- [Django]-Django custom field validator vs. clean
1👍
If you come from Django Tut here’s the problem You just missed a comma after ‘polls.apps.PollsConfig’. so it should be
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
....
]
- [Django]-How to create password input field in django
- [Django]-Get user information in django templates
- [Django]-How to set a value of a variable inside a template code?
0👍
If none of the above/below fix your problem and you came here with the same errors make sure that you do not have a __init__.py
in your top level directory. Hope this helps someone out there!
- [Django]-What is the difference render() and redirect() in Django?
- [Django]-Allowing only super user login
- [Django]-How to output Django queryset as JSON?
-1👍
If we are getting error regarding not a package
than most of the time it may happen that we missed to add __init__.py
file within the directory where we are getting this error.
- [Django]-'RelatedManager' object has no attribute
- [Django]-How to implement FirebaseDB with a Django Web Application
- [Django]-In a django model custom save() method, how should you identify a new object?