How to solve SyntaxError on autogenerated manage.py?

前端 未结 30 1941
囚心锁ツ
囚心锁ツ 2020-11-28 08:24

I\'m following the Django tutorial https://docs.djangoproject.com/es/1.10/intro/tutorial01/

I\'ve created a \"mysite\" dummy project (my very first one) and try to

相关标签:
30条回答
  • 2020-11-28 08:45

    It seems you have more than one version of Python on your computer. Try and remove one and leave the only version you used to develop your application.

    If need be, you can upgrade your version, but ensure you have only one version of Python on your computer.

    I hope this helps.

    0 讨论(0)
  • I had same problem and could solve it. It is related to the version of Django you've installed, some of them are not supported by python 2.7. If you have installed Django with pip, it means that you are installing the latest version of that which probably is not supported in python 2.7, You can get more information about it here. I would suggest to python 3 or specify the version of Django during installing (which is 1.11 for python 2.7).

    0 讨论(0)
  • 2020-11-28 08:47

    I solved same situation.

    INSTALLED VERSION

    python 3.6, django 2.1

    SITUATION

    I installed Node.js in Windows 10. After python manage.py runserver caused error.

    ERROR

    File "manage.py", line 14
    ) from exc
    ^
    SyntaxError: invalid syntax
    

    REASON

    My python path changed to python-2.7 from python-3.6. (3.6 is correct in my PC.)

    SOLUTION

    Fix python path.

    0 讨论(0)
  • 2020-11-28 08:48

    We have to create a virtual environment inside the project, not outside the project.. Then it will solve..

    0 讨论(0)
  • 2020-11-28 08:48

    I landed on the same exact exception because I forgot to activate the virtual environment.

    0 讨论(0)
  • 2020-11-28 08:49

    You can try with python3 manage.py runserver. It works for me.

    0 讨论(0)
提交回复
热议问题