I am unable to use startproject
in Django. In my virtual environment (venv) I can run django-admin
to see a list of subcommands that includes “check”, startproject
etc. I can execute “check” to see information about this command, but when I run django-admin startproject mysite
” I only get a long traceback (see below).
I should also note that I have python37 installed through Anaconda yet I don’t see python37 in my path (I only see old python27). I wonder if the venv django is having trouble seeing python37, or is that not an issue?
Traceback (most recent call last):
File "C:UsersJohnMAppDataLocalProgramsPythonPython35librunpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "C:UsersJohnMAppDataLocalProgramsPythonPython35librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:UsersJohnMjohnvenv-envScriptsdjango-admin.exe__main__.py", line 9, in <module>
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagement__init__.py", line 401, in execute_from_command_line
utility.execute()
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagement__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagement__init__.py", line 244, in fetch_command
klass = load_command_class(app_name, subcommand)
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagement__init__.py", line 37, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:UsersJohnMAppDataLocalProgramsPythonPython35libimportlib__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name(level:), package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagementcommandsstartproject.py", line 1, in <module>
from django.core.management.templates import TemplateCommand
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagementtemplates.py", line 14, in <module>
from django.core.management.utils import handle_extensions
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangocoremanagementutils.py", line 7, in <module>
from django.utils.crypto import get_random_string
File "c:usersjohnmjohnvenv-envlibsite-packagesdjangoutilscrypto.py", line 6, in <module>
import secrets
ImportError: No module named 'secrets'