0

I am trying to make migrations for my Django project, it was working and building fine before I installed and implemented the Django registration-redux module.

These are the errors I currently get and I don't understand why or how to fix it.

 File "/Users/user/Documents/django-projects/tango_with_django_project/manage.py", line 22, in <module>
    main()
  File "/Users/user/Documents/django-projects/tango_with_django_project/manage.py", line 11, in main
    from django.core.management import execute_from_command_line
  File "/opt/homebrew/lib/python3.9/site-packages/django/core/management/__init__.py", line 54
    except ImportError,e:
                      ^
SyntaxError: invalid syntax
Brian61354270
  • 8,690
  • 4
  • 21
  • 43
Declan Morgan
  • 309
  • 3
  • 12
  • 2
    What version of Django are you using? – Willem Van Onsem Sep 10 '21 at 19:30
  • 2
    What version of Python do you think you're using? `except ImportError,e` isn't valid in Python 3, but it was in Python 2. These days you need to write `except ImportError as e`. – Brian61354270 Sep 10 '21 at 19:31
  • I am running Django version 3.2.5 and Python version 3.9.5 – Declan Morgan Sep 10 '21 at 19:32
  • 1
    You have an older version of Django installed. It's not verison 3.2.5, but somewhere around version 1.4 – before Django supported python 3. It says that the code is in `/opt/homebrew/lib/`, so I guess this older version was installed with Homebrew at some point, and this import path is found before where you have the current version of Django. I suggest using some kind of virtual environment to isolate your Django project. – Håken Lid Sep 10 '21 at 19:40
  • @DeclanMorgan: you have installed Django-1.4, you should work with your package manager to upgrade the Django-version. – Willem Van Onsem Sep 10 '21 at 19:40
  • @HåkenLid Thanks that helped, didn't realize that there was an older version installed that would cause difficulties. – Declan Morgan Sep 10 '21 at 19:55

1 Answers1

1

The traceback talks about a line with except ImportError,e: as content. If we look at Django's GitHub repository, this is the case for . Indeed, on GitHub we see for :

    except ImportError,e:

whereas [GitHub] and [GitHub] mention different content.

This thus means that you run a Python application written for with , but these two are not compatible with each other: code written for is not compatible with and vice versa.

You thus should upgrade your Django version. This means that if you use a package manager like pip3 (or use it as package manager of a virtual environment), you upgrade Django with:

pip3 install --upgrade Django
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555