diff --git a/sample_app/urls.py b/sample_app/urls.py new file mode 100644 index 0000000..3ef24d9 --- /dev/null +++ b/sample_app/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] \ No newline at end of file diff --git a/sample_app/views.py b/sample_app/views.py index 91ea44a..d28a4db 100644 --- a/sample_app/views.py +++ b/sample_app/views.py @@ -1,3 +1,4 @@ -from django.shortcuts import render +from django.http import HttpResponse -# Create your views here. +def index(request): + return HttpResponse("こんにちは!世界") \ No newline at end of file diff --git a/sample_site/urls.py b/sample_site/urls.py index 9ef82e5..2e338aa 100644 --- a/sample_site/urls.py +++ b/sample_site/urls.py @@ -14,8 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import include, path urlpatterns = [ + path('sample_app/', include('sample_app.urls')), path('admin/', admin.site.urls), ]