Reputation: 15
I'm attempting to use Django in my Web Programming class, and I'm having issues with the setup. My goal is to have a running default Django app, but, upon running python manage.py runserver
, I get this syntax error for the default code:
File "manage.py", line 17
) from exc
^
SyntaxError: invalid syntax
I also tried running it on python3, which produced a different error. See below:
Traceback (most recent call last):
File "manage.py", line 11, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 17, in main
) from exc
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?
I have Django installed via pip, and can use the django-admin
command. My exact code can be created by running django-admin startproject [name of project]
.
All the best, Ben
Upvotes: 1
Views: 226
Reputation: 812
Try to install Django using built-in pip module
python3 -m pip install django
Upvotes: 1