質問編集履歴
2
該当行の記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -276,6 +276,26 @@
|
|
276
276
|
|
277
277
|
```
|
278
278
|
|
279
|
+
\mysite\mysite\env\lib\site-packages\django\contrib\admin\sites.pyの186行目にあった関数
|
280
|
+
|
281
|
+
```
|
282
|
+
|
283
|
+
def has_permission(self, request):
|
284
|
+
|
285
|
+
"""
|
286
|
+
|
287
|
+
Return True if the given HttpRequest has permission to view
|
288
|
+
|
289
|
+
*at least one* page in the admin site.
|
290
|
+
|
291
|
+
"""
|
292
|
+
|
293
|
+
return request.user.is_active and request.user.is_staff #←186行目。userの部分を変えると'user'の部分が変わります
|
294
|
+
|
295
|
+
```
|
296
|
+
|
297
|
+
|
298
|
+
|
279
299
|
サーバー設定ファイルというのがわからないのですがこれでしょうか...?
|
280
300
|
|
281
301
|
![イメージ説明](df1dbb29da2cb2b591bfbd791812749b.png)
|
1
settings.py等の記入
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,270 @@
|
|
16
16
|
|
17
17
|
![イメージ説明](d76107afdb3203d718b37ad1b955f16d.png)
|
18
18
|
|
19
|
+
settings.pyは以下です。
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
#mysite\settings.py
|
24
|
+
|
25
|
+
"""
|
26
|
+
|
27
|
+
Django settings for mysite project.
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
Generated by 'django-admin startproject' using Django 1.9.1.
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
For more information on this file, see
|
36
|
+
|
37
|
+
https://docs.djangoproject.com/en/1.9/topics/settings/
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
For the full list of settings and their values, see
|
42
|
+
|
43
|
+
https://docs.djangoproject.com/en/1.9/ref/settings/
|
44
|
+
|
45
|
+
"""
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
import os
|
50
|
+
|
51
|
+
import posixpath
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
56
|
+
|
57
|
+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
# Quick-start development settings - unsuitable for production
|
64
|
+
|
65
|
+
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# SECURITY WARNING: keep the secret key used in production secret!
|
70
|
+
|
71
|
+
SECRET_KEY = '4db48398-12d9-4b59-815b-16b1a600008b'
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
# SECURITY WARNING: don't run with debug turned on in production!
|
76
|
+
|
77
|
+
DEBUG = True
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
ALLOWED_HOSTS = []
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
# Application definition
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
INSTALLED_APPS = [
|
92
|
+
|
93
|
+
# Add your apps here to enable them
|
94
|
+
|
95
|
+
'polls.apps.pollsConfig',
|
96
|
+
|
97
|
+
'django.contrib.admin',
|
98
|
+
|
99
|
+
'django.contrib.auth',
|
100
|
+
|
101
|
+
'django.contrib.contenttypes',
|
102
|
+
|
103
|
+
'django.contrib.sessions',
|
104
|
+
|
105
|
+
'django.contrib.messages',
|
106
|
+
|
107
|
+
'django.contrib.staticfiles',
|
108
|
+
|
109
|
+
]
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
MIDDLEWARE_CLASSES = [
|
114
|
+
|
115
|
+
'django.middleware.security.SecurityMiddleware',
|
116
|
+
|
117
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
118
|
+
|
119
|
+
'django.middleware.common.CommonMiddleware',
|
120
|
+
|
121
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
122
|
+
|
123
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
124
|
+
|
125
|
+
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
126
|
+
|
127
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
128
|
+
|
129
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
130
|
+
|
131
|
+
]
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
ROOT_URLCONF = 'mysite.urls'
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
TEMPLATES = [
|
140
|
+
|
141
|
+
{
|
142
|
+
|
143
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
144
|
+
|
145
|
+
'DIRS': [],
|
146
|
+
|
147
|
+
'APP_DIRS': True,
|
148
|
+
|
149
|
+
'OPTIONS': {
|
150
|
+
|
151
|
+
'context_processors': [
|
152
|
+
|
153
|
+
'django.template.context_processors.debug',
|
154
|
+
|
155
|
+
'django.template.context_processors.request',
|
156
|
+
|
157
|
+
'django.contrib.auth.context_processors.auth',
|
158
|
+
|
159
|
+
'django.contrib.messages.context_processors.messages',
|
160
|
+
|
161
|
+
],
|
162
|
+
|
163
|
+
},
|
164
|
+
|
165
|
+
},
|
166
|
+
|
167
|
+
]
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
WSGI_APPLICATION = 'mysite.wsgi.application'
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
# Database
|
178
|
+
|
179
|
+
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
DATABASES = {
|
184
|
+
|
185
|
+
'default': {
|
186
|
+
|
187
|
+
'ENGINE': 'django.db.backends.sqlite3',
|
188
|
+
|
189
|
+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
190
|
+
|
191
|
+
},
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
# Password validation
|
200
|
+
|
201
|
+
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
AUTH_PASSWORD_VALIDATORS = [
|
206
|
+
|
207
|
+
{
|
208
|
+
|
209
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
210
|
+
|
211
|
+
},
|
212
|
+
|
213
|
+
{
|
214
|
+
|
215
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
216
|
+
|
217
|
+
},
|
218
|
+
|
219
|
+
{
|
220
|
+
|
221
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
222
|
+
|
223
|
+
},
|
224
|
+
|
225
|
+
{
|
226
|
+
|
227
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
228
|
+
|
229
|
+
},
|
230
|
+
|
231
|
+
]
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
# Internationalization
|
238
|
+
|
239
|
+
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
LANGUAGE_CODE = 'en-us'
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
TIME_ZONE = 'UTC'
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
USE_I18N = True
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
USE_L10N = True
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
USE_TZ = True
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
# Static files (CSS, JavaScript, Images)
|
266
|
+
|
267
|
+
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
STATIC_URL = '/static/'
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
|
276
|
+
|
277
|
+
```
|
278
|
+
|
279
|
+
サーバー設定ファイルというのがわからないのですがこれでしょうか...?
|
280
|
+
|
281
|
+
![イメージ説明](df1dbb29da2cb2b591bfbd791812749b.png)
|
282
|
+
|
19
283
|
|
20
284
|
|
21
285
|
### バージョン等
|