質問するログイン新規登録

質問編集履歴

1

該当のソースコードにprojectフォルダ内のurls.pyを追記

2020/09/26 14:36

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -78,6 +78,42 @@
78
78
 
79
79
  ```
80
80
 
81
+ projectフォルダ内のurls.py
82
+ ```python
83
+ """project URL Configuration
84
+
85
+ The `urlpatterns` list routes URLs to views. For more information please see:
86
+ https://docs.djangoproject.com/en/2.2/topics/http/urls/
87
+ Examples:
88
+ Function views
89
+ 1. Add an import: from my_app import views
90
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
91
+ Class-based views
92
+ 1. Add an import: from other_app.views import Home
93
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
94
+ Including another URLconf
95
+ 1. Import the include() function: from django.urls import include, path
96
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
97
+ """
98
+ from django.conf import settings
99
+ from django.conf.urls.static import static
100
+ from django.contrib import admin
101
+ from django.urls import path, include
102
+
103
+
104
+ urlpatterns = [
105
+ path('admin/', admin.site.urls),
106
+ path('diaries/', include('diaries.urls')),
107
+ path('reviews/', include('reviews.urls')),
108
+ path('contact/', include('contact.urls')),
109
+ path('videos/', include('videos.urls')),
110
+ path('blog/', include('blog.urls')),
111
+ path('', include('myprofile.urls')),
112
+ ]
113
+
114
+ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
115
+ ```
116
+
81
117
  ### 試したこと
82
118
  Djangoのアプリ起動に関してググった中では以下のコマンドしか見つけられず、複数のアプリをプロジェクト内に持つ場合の切り替えについての記事や説明を見つけられていない状態です。
83
119
  ```