質問編集履歴
2
新しいエラー文の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,29 +8,333 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
###ソースコード(追記のsettings.py)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```python
|
16
|
+
|
17
|
+
import os
|
18
|
+
|
19
|
+
from pathlib import Path
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
SECRET_KEY = 'q6y8^q5+dpgyuk4^jb9^x(f9s#9n$v1hq)zhom$41lhwd7)hhn'
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
DEBUG = True
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
ALLOWED_HOSTS = []
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
INSTALLED_APPS = [
|
40
|
+
|
41
|
+
'django.contrib.admin',
|
42
|
+
|
43
|
+
'django.contrib.auth',
|
44
|
+
|
45
|
+
'django.contrib.contenttypes',
|
46
|
+
|
47
|
+
'django.contrib.sessions',
|
48
|
+
|
49
|
+
'django.contrib.messages',
|
50
|
+
|
51
|
+
'django.contrib.staticfiles',
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
'diary.apps.DiaryConfig'
|
56
|
+
|
57
|
+
]
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
MIDDLEWARE = [
|
62
|
+
|
63
|
+
'django.middleware.security.SecurityMiddleware',
|
64
|
+
|
65
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
66
|
+
|
67
|
+
'django.middleware.common.CommonMiddleware',
|
68
|
+
|
69
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
70
|
+
|
71
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
72
|
+
|
73
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
74
|
+
|
75
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
76
|
+
|
77
|
+
]
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
ROOT_URLCONF = 'private_diary.urls'
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
TEMPLATES = [
|
86
|
+
|
87
|
+
{
|
88
|
+
|
89
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
90
|
+
|
11
|
-
|
91
|
+
'DIRS': [],
|
92
|
+
|
93
|
+
'APP_DIRS': True,
|
94
|
+
|
95
|
+
'OPTIONS': {
|
96
|
+
|
97
|
+
'context_processors': [
|
98
|
+
|
99
|
+
'django.template.context_processors.debug',
|
100
|
+
|
101
|
+
'django.template.context_processors.request',
|
102
|
+
|
103
|
+
'django.contrib.auth.context_processors.auth',
|
104
|
+
|
105
|
+
'django.contrib.messages.context_processors.messages',
|
106
|
+
|
107
|
+
],
|
108
|
+
|
109
|
+
},
|
110
|
+
|
111
|
+
},
|
112
|
+
|
113
|
+
]
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
WSGI_APPLICATION = 'private_diary.wsgi.application'
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
DATABASES = {
|
124
|
+
|
125
|
+
'default': {
|
126
|
+
|
127
|
+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
128
|
+
|
129
|
+
'NAME': 'private_diary',
|
130
|
+
|
131
|
+
'USER': os.environ.get('DB_USER'),
|
132
|
+
|
133
|
+
'PASSWORD': os.environ.get('DB_PASSWORD'),
|
134
|
+
|
135
|
+
'HOST': '',
|
136
|
+
|
137
|
+
'PORT': '',
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
AUTH_PASSWORD_VALIDATORS = [
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
150
|
+
|
151
|
+
},
|
152
|
+
|
153
|
+
{
|
154
|
+
|
155
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
156
|
+
|
157
|
+
},
|
158
|
+
|
159
|
+
{
|
160
|
+
|
161
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
162
|
+
|
163
|
+
},
|
164
|
+
|
165
|
+
{
|
166
|
+
|
167
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
168
|
+
|
169
|
+
},
|
170
|
+
|
171
|
+
]
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
LANGUAGE_CODE = 'ja'
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
TIME_ZONE = 'Asia/Tokyo'
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
USE_I18N = True
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
USE_L10N = True
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
USE_TZ = True
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
STATIC_URL = '/static/'
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
LOGGING = {
|
200
|
+
|
201
|
+
'version': 1,
|
202
|
+
|
203
|
+
'disable_existing_loggers': False,
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
'loggers': {
|
208
|
+
|
209
|
+
'django': {
|
210
|
+
|
211
|
+
'handlers': ['console'],
|
212
|
+
|
213
|
+
'level': 'INFO',
|
214
|
+
|
215
|
+
},
|
216
|
+
|
217
|
+
'diary': {
|
218
|
+
|
219
|
+
'handlers': ['console'],
|
220
|
+
|
221
|
+
'level': 'INFO',
|
222
|
+
|
223
|
+
},
|
224
|
+
|
225
|
+
},
|
226
|
+
|
227
|
+
'handlers': {
|
228
|
+
|
229
|
+
'console': {
|
230
|
+
|
231
|
+
'level': 'DEBUG',
|
232
|
+
|
233
|
+
'class': 'logging.StreamHandler',
|
234
|
+
|
235
|
+
'formatter': 'dev'
|
236
|
+
|
237
|
+
},
|
238
|
+
|
239
|
+
},
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
'formatter': {
|
244
|
+
|
245
|
+
'dev': {
|
246
|
+
|
247
|
+
'format': '\t'.join([
|
248
|
+
|
249
|
+
'%(asctime)s',
|
250
|
+
|
251
|
+
'[%(levelname)s]',
|
252
|
+
|
253
|
+
'%(pathname)s(Line:%(lineno)d)',
|
254
|
+
|
255
|
+
'%(massage)s'
|
256
|
+
|
257
|
+
])
|
258
|
+
|
259
|
+
},
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
}
|
12
264
|
|
13
265
|
|
14
266
|
|
15
267
|
```
|
16
268
|
|
269
|
+
|
270
|
+
|
271
|
+
### 試したこと
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
エラーが多すぎて、わからないのですが
|
276
|
+
|
277
|
+
C:\Users\rikuw\AppData\Local\Programs\Python\Python38\lib\とどのエラーの文に書いているので別のpython.exeを参照してしまっているのかと考えていますが解決法が全く分かりません。
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
### 補足情報(FW/ツールのバージョンなど)
|
284
|
+
|
285
|
+
C:\Users\rikuw\venv_private_diary\private_diaryのmanage.pyをrunserserしました。
|
286
|
+
|
287
|
+
|
288
|
+
|
17
|
-
|
289
|
+
(venv_private_diary)C:\Users\rikuw\venv_private_diary\private_diary>py --version
|
290
|
+
|
18
|
-
|
291
|
+
Python 3.8.5
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
(venv_private_diary)C:\Users\rikuw\venv_private_diary\private_diary>python -m django --version
|
296
|
+
|
297
|
+
3.1.1
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
###追記(スペルミスを直した後のエラーメッセージ)
|
302
|
+
|
303
|
+
```
|
304
|
+
|
305
|
+
2020-09-04 16:41:31,030 [INFO] C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\autoreload.py(Line:612) Watching for file changes with StatReloader
|
306
|
+
|
19
|
-
|
307
|
+
System check identified no issues (0 silenced).
|
20
308
|
|
21
309
|
Exception in thread django-main-thread:
|
22
310
|
|
23
311
|
Traceback (most recent call last):
|
24
312
|
|
25
|
-
File "C:\Users\rikuw\
|
313
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
|
26
|
-
|
314
|
+
|
27
|
-
|
315
|
+
self.connect()
|
28
|
-
|
316
|
+
|
29
|
-
File "C:\Users\rikuw\
|
317
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
318
|
+
|
30
|
-
|
319
|
+
return func(*args, **kwargs)
|
320
|
+
|
321
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
|
322
|
+
|
323
|
+
self.connection = self.get_new_connection(conn_params)
|
324
|
+
|
325
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
326
|
+
|
327
|
+
return func(*args, **kwargs)
|
328
|
+
|
329
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\postgresql\base.py", line 187, in get_new_connection
|
330
|
+
|
31
|
-
|
331
|
+
connection = Database.connect(**conn_params)
|
332
|
+
|
32
|
-
|
333
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\psycopg2\__init__.py", line 127, in connect
|
334
|
+
|
335
|
+
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
|
336
|
+
|
33
|
-
|
337
|
+
psycopg2.OperationalError
|
34
338
|
|
35
339
|
|
36
340
|
|
@@ -40,24 +344,6 @@
|
|
40
344
|
|
41
345
|
Traceback (most recent call last):
|
42
346
|
|
43
|
-
File "C:\Users\rikuw\AppData\Local\Programs\Python\Python38\lib\logging\config.py", line 563, in configure
|
44
|
-
|
45
|
-
handler = self.configure_handler(handlers[name])
|
46
|
-
|
47
|
-
File "C:\Users\rikuw\AppData\Local\Programs\Python\Python38\lib\logging\config.py", line 710, in configure_handler
|
48
|
-
|
49
|
-
raise ValueError('Unable to set formatter '
|
50
|
-
|
51
|
-
ValueError: Unable to set formatter 'dev'
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
The above exception was the direct cause of the following exception:
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
Traceback (most recent call last):
|
60
|
-
|
61
347
|
File "C:\Users\rikuw\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
|
62
348
|
|
63
349
|
self.run()
|
@@ -70,328 +356,82 @@
|
|
70
356
|
|
71
357
|
fn(*args, **kwargs)
|
72
358
|
|
73
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\core\management\commands\runserver.py", line 11
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\
|
78
|
-
|
79
|
-
rai
|
80
|
-
|
81
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\
|
86
|
-
|
87
|
-
f
|
88
|
-
|
89
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
File "C:\Users\rikuw\
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
File "C:\Users\rikuw\
|
102
|
-
|
103
|
-
r
|
104
|
-
|
105
|
-
|
359
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
|
360
|
+
|
361
|
+
self.check_migrations()
|
362
|
+
|
363
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\core\management\base.py", line 459, in check_migrations
|
364
|
+
|
365
|
+
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
|
366
|
+
|
367
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
|
368
|
+
|
369
|
+
self.loader = MigrationLoader(self.connection)
|
370
|
+
|
371
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
|
372
|
+
|
373
|
+
self.build_graph()
|
374
|
+
|
375
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\migrations\loader.py", line 216, in build_graph
|
376
|
+
|
377
|
+
self.applied_migrations = recorder.applied_migrations()
|
378
|
+
|
379
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\migrations\recorder.py", line 77, in applied_migrations
|
380
|
+
|
381
|
+
if self.has_table():
|
382
|
+
|
383
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\migrations\recorder.py", line 55, in has_table
|
384
|
+
|
385
|
+
with self.connection.cursor() as cursor:
|
386
|
+
|
387
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
388
|
+
|
389
|
+
return func(*args, **kwargs)
|
390
|
+
|
391
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 259, in cursor
|
392
|
+
|
393
|
+
return self._cursor()
|
394
|
+
|
395
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 235, in _cursor
|
396
|
+
|
397
|
+
self.ensure_connection()
|
398
|
+
|
399
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
400
|
+
|
401
|
+
return func(*args, **kwargs)
|
402
|
+
|
403
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
|
404
|
+
|
405
|
+
self.connect()
|
406
|
+
|
407
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\utils.py", line 90, in __exit__
|
408
|
+
|
409
|
+
raise dj_exc_value.with_traceback(traceback) from exc_value
|
410
|
+
|
411
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 219, in ensure_connection
|
412
|
+
|
413
|
+
self.connect()
|
414
|
+
|
415
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
416
|
+
|
417
|
+
return func(*args, **kwargs)
|
418
|
+
|
419
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\base\base.py", line 200, in connect
|
420
|
+
|
421
|
+
self.connection = self.get_new_connection(conn_params)
|
422
|
+
|
423
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\utils\asyncio.py", line 26, in inner
|
424
|
+
|
425
|
+
return func(*args, **kwargs)
|
426
|
+
|
427
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\django\db\backends\postgresql\base.py", line 187, in get_new_connection
|
428
|
+
|
429
|
+
connection = Database.connect(**conn_params)
|
430
|
+
|
431
|
+
File "C:\Users\rikuw\venv_private_diary\lib\site-packages\psycopg2\__init__.py", line 127, in connect
|
432
|
+
|
433
|
+
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
|
434
|
+
|
435
|
+
django.db.utils.OperationalError
|
106
436
|
|
107
437
|
```
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
###ソースコード(追記のsettings.py)
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
```python
|
116
|
-
|
117
|
-
import os
|
118
|
-
|
119
|
-
from pathlib import Path
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
BASE_DIR = Path(__file__).resolve().parent.parent
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
SECRET_KEY = 'q6y8^q5+dpgyuk4^jb9^x(f9s#9n$v1hq)zhom$41lhwd7)hhn'
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
DEBUG = True
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
ALLOWED_HOSTS = []
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
INSTALLED_APPS = [
|
140
|
-
|
141
|
-
'django.contrib.admin',
|
142
|
-
|
143
|
-
'django.contrib.auth',
|
144
|
-
|
145
|
-
'django.contrib.contenttypes',
|
146
|
-
|
147
|
-
'django.contrib.sessions',
|
148
|
-
|
149
|
-
'django.contrib.messages',
|
150
|
-
|
151
|
-
'django.contrib.staticfiles',
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
'diary.apps.DiaryConfig'
|
156
|
-
|
157
|
-
]
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
MIDDLEWARE = [
|
162
|
-
|
163
|
-
'django.middleware.security.SecurityMiddleware',
|
164
|
-
|
165
|
-
'django.contrib.sessions.middleware.SessionMiddleware',
|
166
|
-
|
167
|
-
'django.middleware.common.CommonMiddleware',
|
168
|
-
|
169
|
-
'django.middleware.csrf.CsrfViewMiddleware',
|
170
|
-
|
171
|
-
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
172
|
-
|
173
|
-
'django.contrib.messages.middleware.MessageMiddleware',
|
174
|
-
|
175
|
-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
176
|
-
|
177
|
-
]
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
ROOT_URLCONF = 'private_diary.urls'
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
TEMPLATES = [
|
186
|
-
|
187
|
-
{
|
188
|
-
|
189
|
-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
190
|
-
|
191
|
-
'DIRS': [],
|
192
|
-
|
193
|
-
'APP_DIRS': True,
|
194
|
-
|
195
|
-
'OPTIONS': {
|
196
|
-
|
197
|
-
'context_processors': [
|
198
|
-
|
199
|
-
'django.template.context_processors.debug',
|
200
|
-
|
201
|
-
'django.template.context_processors.request',
|
202
|
-
|
203
|
-
'django.contrib.auth.context_processors.auth',
|
204
|
-
|
205
|
-
'django.contrib.messages.context_processors.messages',
|
206
|
-
|
207
|
-
],
|
208
|
-
|
209
|
-
},
|
210
|
-
|
211
|
-
},
|
212
|
-
|
213
|
-
]
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
WSGI_APPLICATION = 'private_diary.wsgi.application'
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
DATABASES = {
|
224
|
-
|
225
|
-
'default': {
|
226
|
-
|
227
|
-
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
228
|
-
|
229
|
-
'NAME': 'private_diary',
|
230
|
-
|
231
|
-
'USER': os.environ.get('DB_USER'),
|
232
|
-
|
233
|
-
'PASSWORD': os.environ.get('DB_PASSWORD'),
|
234
|
-
|
235
|
-
'HOST': '',
|
236
|
-
|
237
|
-
'PORT': '',
|
238
|
-
|
239
|
-
}
|
240
|
-
|
241
|
-
}
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
AUTH_PASSWORD_VALIDATORS = [
|
246
|
-
|
247
|
-
{
|
248
|
-
|
249
|
-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
250
|
-
|
251
|
-
},
|
252
|
-
|
253
|
-
{
|
254
|
-
|
255
|
-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
256
|
-
|
257
|
-
},
|
258
|
-
|
259
|
-
{
|
260
|
-
|
261
|
-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
262
|
-
|
263
|
-
},
|
264
|
-
|
265
|
-
{
|
266
|
-
|
267
|
-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
268
|
-
|
269
|
-
},
|
270
|
-
|
271
|
-
]
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
LANGUAGE_CODE = 'ja'
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
TIME_ZONE = 'Asia/Tokyo'
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
USE_I18N = True
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
USE_L10N = True
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
USE_TZ = True
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
STATIC_URL = '/static/'
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
LOGGING = {
|
300
|
-
|
301
|
-
'version': 1,
|
302
|
-
|
303
|
-
'disable_existing_loggers': False,
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
'loggers': {
|
308
|
-
|
309
|
-
'django': {
|
310
|
-
|
311
|
-
'handlers': ['console'],
|
312
|
-
|
313
|
-
'level': 'INFO',
|
314
|
-
|
315
|
-
},
|
316
|
-
|
317
|
-
'diary': {
|
318
|
-
|
319
|
-
'handlers': ['console'],
|
320
|
-
|
321
|
-
'level': 'INFO',
|
322
|
-
|
323
|
-
},
|
324
|
-
|
325
|
-
},
|
326
|
-
|
327
|
-
'handlers': {
|
328
|
-
|
329
|
-
'console': {
|
330
|
-
|
331
|
-
'level': 'DEBUG',
|
332
|
-
|
333
|
-
'class': 'logging.StreamHandler',
|
334
|
-
|
335
|
-
'formatter': 'dev'
|
336
|
-
|
337
|
-
},
|
338
|
-
|
339
|
-
},
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
'formatter': {
|
344
|
-
|
345
|
-
'dev': {
|
346
|
-
|
347
|
-
'format': '\t'.join([
|
348
|
-
|
349
|
-
'%(asctime)s',
|
350
|
-
|
351
|
-
'[%(levelname)s]',
|
352
|
-
|
353
|
-
'%(pathname)s(Line:%(lineno)d)',
|
354
|
-
|
355
|
-
'%(massage)s'
|
356
|
-
|
357
|
-
])
|
358
|
-
|
359
|
-
},
|
360
|
-
|
361
|
-
}
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
```
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
### 試したこと
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
エラーが多すぎて、わからないのですが
|
376
|
-
|
377
|
-
C:\Users\rikuw\AppData\Local\Programs\Python\Python38\lib\とどのエラーの文に書いているので別のpython.exeを参照してしまっているのかと考えていますが解決法が全く分かりません。
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
### 補足情報(FW/ツールのバージョンなど)
|
384
|
-
|
385
|
-
C:\Users\rikuw\venv_private_diary\private_diaryのmanage.pyをrunserserしました。
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
(venv_private_diary)C:\Users\rikuw\venv_private_diary\private_diary>py --version
|
390
|
-
|
391
|
-
Python 3.8.5
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
(venv_private_diary)C:\Users\rikuw\venv_private_diary\private_diary>python -m django --version
|
396
|
-
|
397
|
-
3.1.1
|
1
settings.pyのコードを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -108,6 +108,264 @@
|
|
108
108
|
|
109
109
|
|
110
110
|
|
111
|
+
###ソースコード(追記のsettings.py)
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
```python
|
116
|
+
|
117
|
+
import os
|
118
|
+
|
119
|
+
from pathlib import Path
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
SECRET_KEY = 'q6y8^q5+dpgyuk4^jb9^x(f9s#9n$v1hq)zhom$41lhwd7)hhn'
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
DEBUG = True
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
ALLOWED_HOSTS = []
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
INSTALLED_APPS = [
|
140
|
+
|
141
|
+
'django.contrib.admin',
|
142
|
+
|
143
|
+
'django.contrib.auth',
|
144
|
+
|
145
|
+
'django.contrib.contenttypes',
|
146
|
+
|
147
|
+
'django.contrib.sessions',
|
148
|
+
|
149
|
+
'django.contrib.messages',
|
150
|
+
|
151
|
+
'django.contrib.staticfiles',
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
'diary.apps.DiaryConfig'
|
156
|
+
|
157
|
+
]
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
MIDDLEWARE = [
|
162
|
+
|
163
|
+
'django.middleware.security.SecurityMiddleware',
|
164
|
+
|
165
|
+
'django.contrib.sessions.middleware.SessionMiddleware',
|
166
|
+
|
167
|
+
'django.middleware.common.CommonMiddleware',
|
168
|
+
|
169
|
+
'django.middleware.csrf.CsrfViewMiddleware',
|
170
|
+
|
171
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
172
|
+
|
173
|
+
'django.contrib.messages.middleware.MessageMiddleware',
|
174
|
+
|
175
|
+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
176
|
+
|
177
|
+
]
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
ROOT_URLCONF = 'private_diary.urls'
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
TEMPLATES = [
|
186
|
+
|
187
|
+
{
|
188
|
+
|
189
|
+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
190
|
+
|
191
|
+
'DIRS': [],
|
192
|
+
|
193
|
+
'APP_DIRS': True,
|
194
|
+
|
195
|
+
'OPTIONS': {
|
196
|
+
|
197
|
+
'context_processors': [
|
198
|
+
|
199
|
+
'django.template.context_processors.debug',
|
200
|
+
|
201
|
+
'django.template.context_processors.request',
|
202
|
+
|
203
|
+
'django.contrib.auth.context_processors.auth',
|
204
|
+
|
205
|
+
'django.contrib.messages.context_processors.messages',
|
206
|
+
|
207
|
+
],
|
208
|
+
|
209
|
+
},
|
210
|
+
|
211
|
+
},
|
212
|
+
|
213
|
+
]
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
WSGI_APPLICATION = 'private_diary.wsgi.application'
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
DATABASES = {
|
224
|
+
|
225
|
+
'default': {
|
226
|
+
|
227
|
+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
228
|
+
|
229
|
+
'NAME': 'private_diary',
|
230
|
+
|
231
|
+
'USER': os.environ.get('DB_USER'),
|
232
|
+
|
233
|
+
'PASSWORD': os.environ.get('DB_PASSWORD'),
|
234
|
+
|
235
|
+
'HOST': '',
|
236
|
+
|
237
|
+
'PORT': '',
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
AUTH_PASSWORD_VALIDATORS = [
|
246
|
+
|
247
|
+
{
|
248
|
+
|
249
|
+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
250
|
+
|
251
|
+
},
|
252
|
+
|
253
|
+
{
|
254
|
+
|
255
|
+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
256
|
+
|
257
|
+
},
|
258
|
+
|
259
|
+
{
|
260
|
+
|
261
|
+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
262
|
+
|
263
|
+
},
|
264
|
+
|
265
|
+
{
|
266
|
+
|
267
|
+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
268
|
+
|
269
|
+
},
|
270
|
+
|
271
|
+
]
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
LANGUAGE_CODE = 'ja'
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
TIME_ZONE = 'Asia/Tokyo'
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
USE_I18N = True
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
USE_L10N = True
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
USE_TZ = True
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
STATIC_URL = '/static/'
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
LOGGING = {
|
300
|
+
|
301
|
+
'version': 1,
|
302
|
+
|
303
|
+
'disable_existing_loggers': False,
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
'loggers': {
|
308
|
+
|
309
|
+
'django': {
|
310
|
+
|
311
|
+
'handlers': ['console'],
|
312
|
+
|
313
|
+
'level': 'INFO',
|
314
|
+
|
315
|
+
},
|
316
|
+
|
317
|
+
'diary': {
|
318
|
+
|
319
|
+
'handlers': ['console'],
|
320
|
+
|
321
|
+
'level': 'INFO',
|
322
|
+
|
323
|
+
},
|
324
|
+
|
325
|
+
},
|
326
|
+
|
327
|
+
'handlers': {
|
328
|
+
|
329
|
+
'console': {
|
330
|
+
|
331
|
+
'level': 'DEBUG',
|
332
|
+
|
333
|
+
'class': 'logging.StreamHandler',
|
334
|
+
|
335
|
+
'formatter': 'dev'
|
336
|
+
|
337
|
+
},
|
338
|
+
|
339
|
+
},
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
'formatter': {
|
344
|
+
|
345
|
+
'dev': {
|
346
|
+
|
347
|
+
'format': '\t'.join([
|
348
|
+
|
349
|
+
'%(asctime)s',
|
350
|
+
|
351
|
+
'[%(levelname)s]',
|
352
|
+
|
353
|
+
'%(pathname)s(Line:%(lineno)d)',
|
354
|
+
|
355
|
+
'%(massage)s'
|
356
|
+
|
357
|
+
])
|
358
|
+
|
359
|
+
},
|
360
|
+
|
361
|
+
}
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
```
|
368
|
+
|
111
369
|
|
112
370
|
|
113
371
|
### 試したこと
|