プロジェクトにviewを作成
プロジェクトのURL
testprj/urls.py
from django.contrib import admin
from django.urls import include, path
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('testprj.testapp.urls')),
]
アプリケーションのURL
testprj/testapp/urls.py
from django.conf.urls import url
from django.urls import include, path
from . import views
urlpatterns = [
path('', include('testprj.testapp.views.urls')),
path('app1/', include('testprj.testapp.views.urls')),
]
viewのviewのURL
testprj/testapp/views/urls.py
from django.conf.urls import url
from django.urls import include, path
from . import views, views2
urlpatterns = [
path('', views.index, name='index'),
path('app2/', views2.index, name='index'),
]
コメント(0)