How to solve SyntaxError on autogenerated manage.py?

前端 未结 30 2207
囚心锁ツ
囚心锁ツ 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:56

    The django-admin maybe the wrong file.I met the same problem which I did not found on a different computer the same set-up flow.

    After comparing two project, I found several difference at manage.py and settings.py, then I realized I created 2.0 django project but run it with python2.

    runwhich django-adminin iterm

    /Library/Frameworks/Python.framework/Versions/3.6/bin/django-admin
    

    It looks like I got a django-admin in python3 which I didn't know why.So I tried to get the correct django-amin.

    pip show django
    

    then I got

    Name: Django
    Version: 1.11a1
    Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
    Home-page: https://www.djangoproject.com/
    Author: Django Software Foundation
    Author-email: foundation@djangoproject.com
    License: BSD
    Location: /Library/Python/2.7/site-packages
    Requires: pytz
    

    In/Library/Python/2.7/site-packages, I found the django-admin

    /Library/Python/2.7/site-packages/django/bin/django-admin.py
    

    So I created project again by

    /Library/Python/2.7/site-packages/django/bin/django-admin.py startproject myproject
    

    then run

    cd myproject
    python manage.py runserver
    

    succeeded

提交回复
热议问题