質問編集履歴
4
urls.pyを追加しました!
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,6 +132,19 @@
|
|
132
132
|
|
133
133
|
```
|
134
134
|
|
135
|
+
```app/urls.py
|
136
|
+
from rest_framework import routers
|
137
|
+
from .views import UserViewSet, Post_officeViewSet,Good_tableViewSet,Follow_tableViewSet
|
138
|
+
|
139
|
+
app_name= "app"
|
140
|
+
router = routers.DefaultRouter()
|
141
|
+
router.register(r'users/', UserViewSet)
|
142
|
+
router.register(r'post_office/', Post_officeViewSet)
|
143
|
+
router.register(r'good_table', Good_tableViewSet)
|
144
|
+
router.register(r'follow_table', Follow_tableViewSet)
|
145
|
+
#snsを製作中です。
|
146
|
+
```
|
147
|
+
|
135
148
|
```tree
|
136
149
|
|
137
150
|
├── config
|
3
アプリ名が色々ごっちゃになってましたので、修正をしました。ご迷惑おかけしました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
urlpatterns = [
|
19
19
|
path(r'^admin/', admin.site.urls),
|
20
20
|
# blog.urlsをincludeする
|
21
|
-
path(r'^api/', include("
|
21
|
+
path(r'^api/', include("app.urls")),
|
22
22
|
]
|
23
23
|
```
|
24
24
|
```settings.py
|
2
アプリ名が色々ごっちゃになってましたので、修正をしました。ご迷惑おかけしました。
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
from django.contrib import admin from django.urls import path,include # include を追記 #from
|
1
|
+
from django.contrib import admin from django.urls import path,include # include を追記 #from app.url
|
body
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
|
8
|
-
django.core.exceptions.ImproperlyConfigured: The included URLconf '
|
8
|
+
django.core.exceptions.ImproperlyConfigured: The included URLconf 'app.urls' does
|
9
9
|
not appear to have any patterns in it. If you see the 'urlpatterns' variable with
|
10
10
|
valid patterns in the file then the issue is probably caused by a circular import.
|
11
11
|
```
|
1
treeを追加しました。すいません!
title
CHANGED
File without changes
|
body
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
'django.contrib.sessions',
|
39
39
|
'django.contrib.messages',
|
40
40
|
'django.contrib.staticfiles',
|
41
|
-
'
|
41
|
+
'app', #アプリ名
|
42
42
|
]
|
43
43
|
|
44
44
|
MIDDLEWARE = [
|
@@ -52,7 +52,7 @@
|
|
52
52
|
'whitenoise.middleware.WhiteNoiseMiddleware', #追加
|
53
53
|
]
|
54
54
|
|
55
|
-
ROOT_URLCONF = '
|
55
|
+
ROOT_URLCONF = 'app.urls' #アプリ名
|
56
56
|
|
57
57
|
TEMPLATES = [
|
58
58
|
{
|
@@ -70,7 +70,7 @@
|
|
70
70
|
},
|
71
71
|
]
|
72
72
|
|
73
|
-
WSGI_APPLICATION = '
|
73
|
+
WSGI_APPLICATION = 'app.wsgi.application' #ご自身のアプリ名
|
74
74
|
|
75
75
|
DATABASES = {
|
76
76
|
'default': {
|
@@ -132,4 +132,27 @@
|
|
132
132
|
|
133
133
|
```
|
134
134
|
|
135
|
-
|
135
|
+
```tree
|
136
|
+
|
137
|
+
├── config
|
138
|
+
│ ├── __init__.py
|
139
|
+
│ ├── __pycache__
|
140
|
+
│ ├── local_settings.py
|
141
|
+
│ ├── settings.py
|
142
|
+
│ ├── urls.py
|
143
|
+
│ └── wsgi.py
|
144
|
+
├── manage.py
|
145
|
+
└── app
|
146
|
+
├── __init__.py
|
147
|
+
├── __pycache__
|
148
|
+
├── admin.py
|
149
|
+
├── apps.py
|
150
|
+
├── migrations
|
151
|
+
│ └── __init__.py
|
152
|
+
├── models.py
|
153
|
+
├── serializer.py
|
154
|
+
├── tests.py
|
155
|
+
├── urls.py
|
156
|
+
└── views.py
|
157
|
+
|
158
|
+
```
|