ModuleNotFoundError: No module named 'playground/urls' I am going through the ultimate django series by mosh hamedani and i came across a problem. I did exactly as he did and it didn't work for me. Here are my urls.py and installed apps.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.staticfiles',
'playground'
]
playground/urls.py
from django.urls import path
from . import views
#URLConf
urlpatterns = [
path('hello/', views.say_hello)
]
storefront/urls.py
"""storefront URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.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, include
urlpatterns = [
path('admin/', admin.site.urls),
path('playground/', include('playground/urls'))
]
CodePudding user response:
maybe using include('appname.urls')
change
path('playground/', include('playground/urls'))
to
path('playground/', include('playground.urls'))
CodePudding user response:
Try :
path('playground/', include('playground.urls'))
Insteed of:
path('playground/', include('playground/urls'))
You can check that part on Django tutorial
Hope that help you !
CodePudding user response:
if you post what the terminal gives you that's also sometimes is helpful, as i understand it The Model Does not exist,
try python mange.py makemigrations