1 year ago

#356884

test-img

chirag

Why i am getting this error AttributeError: module 'collections' has no attribute 'Iterator while creating django project in django version 2.0.7?

Hi i am learning Django from this youtube video Python Django Web Framework - Full Course for Beginners from freecodecamp when i tried to create a project using Django 2.0.7 in virtual environment. i am getting this error AttributeError: module 'collections' has no attribute 'Iterator dont know why please help me to fix this.

I am doing exactly what was shown in that tutorial like i created virualenvironment then i installed django 2.0.7 then i ran command django-admin startproject trydjango . But i am getting this error.please tell me how to fix this

i tried with creating another virtual environment and even tried with othernames for project but i am keep on getting this error and i even tried to create it without . at end of the line like

django-admin startproject trydjango

instead of

django-admin startproject trydjango .

Then it gives same error with a empty trydjango folder

(venv) C:\Users\chirag\Dev\trydjango>django-admin startproject trydjango .
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\chirag\Dev\trydjango\venv\Scripts\django-admin.exe\__main__.py", line 7, in <module>
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\commands\startproject.py", line 20, in handle
    super().handle('project', project_name, target, **options)
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\management\templates.py", line 117, in handle
    django.setup()
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\__init__.py", line 16, in setup
    from django.urls import set_script_prefix
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\urls\__init__.py", line 1, in <module>
    from .base import (
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\urls\base.py", line 8, in <module>
    from .exceptions import NoReverseMatch, Resolver404
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\urls\exceptions.py", line 1, in <module>
    from django.http import Http404
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\http\__init__.py", line 5, in <module>
    from django.http.response import (
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\http\response.py", line 13, in <module>
    from django.core.serializers.json import DjangoJSONEncoder
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\serializers\__init__.py", line 23, in <module>
    from django.core.serializers.base import SerializerDoesNotExist
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\core\serializers\base.py", line 6, in <module>
    from django.db import models
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\db\models\__init__.py", line 3, in <module>
    from django.db.models.aggregates import *  # NOQA
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\db\models\aggregates.py", line 5, in <module>
    from django.db.models.expressions import Case, Func, Star, When
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\db\models\expressions.py", line 486, in <module>
    class TemporalSubtraction(CombinedExpression):
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\db\models\expressions.py", line 487, in TemporalSubtraction
    output_field = fields.DurationField()
  File "C:\Users\chirag\Dev\trydjango\venv\lib\site-packages\django\db\models\fields\__init__.py", line 155, in __init__
    if isinstance(choices, collections.Iterator):
AttributeError: module 'collections' has no attribute 'Iterator'

python

django

django-errors

0 Answers

Your Answer

Accepted video resources