I am new to python and Django. I am learning using the MDN text guide. This is what I followed to setup my computer-https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment#Using_a_virtual_environment
This is what my command prompt shows me when I try to test my development webserver
(my_django_environment2) C:\Users\user\Desktop\django_gopal\mytestsite>py -3 manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001FEB45AD8C8>
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\utils\autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\management\commands\runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\management\base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\checks\registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\checks\urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\checks\urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\utils\functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python36\lib\site-packages\django-1.9-py3.6.egg\django\core\urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\user\Desktop\django_gopal\mytestsite\mytestsite\urls.py", line 17, in <module>
from django.urls import path
ModuleNotFoundError: No module named 'django.urls'
urls.py
"""mytestsite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
I did get the development server to work initially but after following the 2nd part of the MDN tutorial-(https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/skeleton_website) and trying to test my skeleton website is when I first started getting this error.
At this point I had django 1.9 but after reviewing this question-(ModuleNotFoundError: No module named 'django.urls'), I upgraded to django 2.2.The environment variable and project were both created after upgrading. I still however, continued to get the same error. I then tried to build a new test site by following the first part(MDN text guide) again but this time with a different virtual environment but again got the same error.
Any help is appreciated