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 test it without altering it.
django-admin startproject mysite
cd mysite
python manage.py runserver
File "manage.py", line 14
) from exc
^
SyntaxError: invalid syntax
I'm getting a SyntaxError on a file that was generated by the system itself. And I seem unable to find anyone else who has gone through the same issue.
I'll add some data of my setup in case it may be of use
$ vpython --version
Python 2.7.12
$ pip --version
pip 9.0.1 from /home/frank/.local/lib/python2.7/site-packages (python 2.7)
$ python -m django --version
1.10.6
Adding contents of autogenerated manage.py
cat manage.py
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…