質問編集履歴

5

追加以来があったため

2020/12/30 11:57

投稿

haruchan__
haruchan__

スコア7

test CHANGED
File without changes
test CHANGED
@@ -409,3 +409,17 @@
409
409
 
410
410
 
411
411
  ```
412
+
413
+
414
+
415
+ ログインは.envにて行っています>
416
+
417
+ .env
418
+
419
+
420
+
421
+ ```
422
+
423
+ DATABASE_URL=mysql://root:root@localhost/shain
424
+
425
+ ```

4

追加以来があったため

2020/12/30 11:57

投稿

haruchan__
haruchan__

スコア7

test CHANGED
File without changes
test CHANGED
@@ -151,3 +151,261 @@
151
151
  抽象的で申し訳ないのですが、上記のエラーはどのようなエラーにあたるのでしょうか?
152
152
 
153
153
  ご教授お願い致します。
154
+
155
+
156
+
157
+ 追記
158
+
159
+ settings.pyをのせます。
160
+
161
+ ```ここに言語を入力
162
+
163
+ """
164
+
165
+ Django settings for jigokadai project.
166
+
167
+
168
+
169
+ Generated by 'django-admin startproject' using Django 3.1.4.
170
+
171
+
172
+
173
+ For more information on this file, see
174
+
175
+ https://docs.djangoproject.com/en/3.1/topics/settings/
176
+
177
+
178
+
179
+ For the full list of settings and their values, see
180
+
181
+ https://docs.djangoproject.com/en/3.1/ref/settings/
182
+
183
+ """
184
+
185
+
186
+
187
+ from pathlib import Path
188
+
189
+
190
+
191
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
192
+
193
+ BASE_DIR = Path(__file__).resolve().parent.parent
194
+
195
+
196
+
197
+
198
+
199
+ # Quick-start development settings - unsuitable for production
200
+
201
+ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
202
+
203
+
204
+
205
+ # SECURITY WARNING: keep the secret key used in production secret!
206
+
207
+ SECRET_KEY = '&7c=2vsm_-5^bgl+j#*p04jlrxkyj!%scqd3k6#8-21%88wjrj'
208
+
209
+
210
+
211
+ # SECURITY WARNING: don't run with debug turned on in production!
212
+
213
+ DEBUG = True
214
+
215
+
216
+
217
+ ALLOWED_HOSTS = ['*']
218
+
219
+
220
+
221
+
222
+
223
+ # Application definition
224
+
225
+
226
+
227
+ INSTALLED_APPS = [
228
+
229
+ 'django.contrib.admin',
230
+
231
+ 'django.contrib.auth',
232
+
233
+ 'django.contrib.contenttypes',
234
+
235
+ 'django.contrib.sessions',
236
+
237
+ 'django.contrib.messages',
238
+
239
+ 'django.contrib.staticfiles',
240
+
241
+ 'website',
242
+
243
+ ]
244
+
245
+
246
+
247
+ MIDDLEWARE = [
248
+
249
+ 'django.middleware.security.SecurityMiddleware',
250
+
251
+ 'django.contrib.sessions.middleware.SessionMiddleware',
252
+
253
+ 'django.middleware.common.CommonMiddleware',
254
+
255
+ 'django.middleware.csrf.CsrfViewMiddleware',
256
+
257
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
258
+
259
+ 'django.contrib.messages.middleware.MessageMiddleware',
260
+
261
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
262
+
263
+ ]
264
+
265
+
266
+
267
+ ROOT_URLCONF = 'jigokadai.urls'
268
+
269
+
270
+
271
+ TEMPLATES = [
272
+
273
+ {
274
+
275
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
276
+
277
+ 'DIRS': [],
278
+
279
+ 'APP_DIRS': True,
280
+
281
+ 'OPTIONS': {
282
+
283
+ 'context_processors': [
284
+
285
+ 'django.template.context_processors.debug',
286
+
287
+ 'django.template.context_processors.request',
288
+
289
+ 'django.contrib.auth.context_processors.auth',
290
+
291
+ 'django.contrib.messages.context_processors.messages',
292
+
293
+ ],
294
+
295
+ },
296
+
297
+ },
298
+
299
+ ]
300
+
301
+
302
+
303
+ WSGI_APPLICATION = 'jigokadai.wsgi.application'
304
+
305
+
306
+
307
+
308
+
309
+ # Database
310
+
311
+ # https://docs.djangoproject.com/en/3.1/ref/settings/#databases
312
+
313
+
314
+
315
+ import dj_database_url
316
+
317
+ from dotenv import (
318
+
319
+ find_dotenv,
320
+
321
+ load_dotenv,
322
+
323
+ )
324
+
325
+ load_dotenv(find_dotenv())
326
+
327
+ DATABASES = {
328
+
329
+ 'default': dj_database_url.config(conn_max_age=600),
330
+
331
+ }
332
+
333
+
334
+
335
+ # Password validation
336
+
337
+ # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
338
+
339
+
340
+
341
+ AUTH_PASSWORD_VALIDATORS = [
342
+
343
+ {
344
+
345
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
346
+
347
+ },
348
+
349
+ {
350
+
351
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
352
+
353
+ },
354
+
355
+ {
356
+
357
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
358
+
359
+ },
360
+
361
+ {
362
+
363
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
364
+
365
+ },
366
+
367
+ ]
368
+
369
+
370
+
371
+
372
+
373
+ # Internationalization
374
+
375
+ # https://docs.djangoproject.com/en/3.1/topics/i18n/
376
+
377
+
378
+
379
+ LANGUAGE_CODE = 'ja'
380
+
381
+
382
+
383
+ TIME_ZONE = 'Asia/Tokyo'
384
+
385
+
386
+
387
+ USE_I18N = True
388
+
389
+
390
+
391
+ USE_L10N = True
392
+
393
+
394
+
395
+ USE_TZ = True
396
+
397
+
398
+
399
+
400
+
401
+ # Static files (CSS, JavaScript, Images)
402
+
403
+ # https://docs.djangoproject.com/en/3.1/howto/static-files/
404
+
405
+
406
+
407
+ STATIC_URL = '/static/'
408
+
409
+
410
+
411
+ ```

3

初心マークの追加

2020/12/30 11:55

投稿

haruchan__
haruchan__

スコア7

test CHANGED
File without changes
test CHANGED
@@ -17,6 +17,8 @@
17
17
  db    :mysql 5.6.xx
18
18
 
19
19
  です。
20
+
21
+
20
22
 
21
23
 
22
24
 

2

開発環境の追記

2020/12/29 23:55

投稿

haruchan__
haruchan__

スコア7

test CHANGED
@@ -1 +1 @@
1
- djangoとmysqlの接続につ
1
+ djangoとmysqlの接続確認時のmigrateのエラーで困っています
test CHANGED
@@ -3,6 +3,20 @@
3
3
 
4
4
 
5
5
  文献や動画等を参考にしながら、manage.pyをmigrateしてみたところ下記のようなエラーの内容が発生しました。
6
+
7
+
8
+
9
+ 開発環境
10
+
11
+ エディタ :VScode
12
+
13
+ 言語 :python3.XX
14
+
15
+ フレームワーク :django
16
+
17
+ db    :mysql 5.6.xx
18
+
19
+ です。
6
20
 
7
21
 
8
22
 

1

コードの修正

2020/12/29 23:49

投稿

haruchan__
haruchan__

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,11 +8,45 @@
8
8
 
9
9
  ```ここに言語を入力
10
10
 
11
+ Traceback (most recent call last):
12
+
13
+ File "C:\Users\shunn\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\utils.py", line 111, in load_backend
14
+
15
+ return import_module('%s.base' % backend_name)
16
+
17
+ File "C:\Users\shunn\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
18
+
19
+ return _bootstrap._gcd_import(name[level:], package, level)
20
+
21
+ File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
22
+
23
+ File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
24
+
25
+ File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
26
+
27
+ File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
28
+
29
+ File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
30
+
31
+ File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
32
+
33
+ File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
34
+
35
+ ModuleNotFoundError: No module named 'django.db.backends.mysql'
36
+
37
+
38
+
39
+ The above exception was the direct cause of the following exception:
40
+
41
+
42
+
43
+ Traceback (most recent call last):
44
+
11
- File "C:\Users\shunn\Desktop\jigokadai\manage.py", line 24, in <module>
45
+ File "C:\Users\shunn\Desktop\jigokadai\manage.py", line 22, in <module>
12
46
 
13
47
  main()
14
48
 
15
- File "C:\Users\shunn\Desktop\jigokadai\manage.py", line 20, in main
49
+ File "C:\Users\shunn\Desktop\jigokadai\manage.py", line 18, in main
16
50
 
17
51
  execute_from_command_line(sys.argv)
18
52