티스토리 뷰
IT/프로그래밍
[Python/Django] NameError: name '_mysql' is not defined, django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.3 or newer is required; you have 1.0.2. 해결방법
ko dean 2023. 8. 16. 06:54어쩌다보니 Django를 써야할 일이 생겨서 프로젝트를 생성하고 python manage.py migrate를 실행했는데
NameError: name '_mysql' is not defined
에러가 발생해서 찾다보니
pymysql을 설치해서 쓰면 된다고해서 설치해봤더니 잘되었다.
해결방법은 다음과 같다.
1. pip install pymysql
2. settings.py에 import pymysql
3. 다음 코드 추가
pymysql.install_as_MySQLdb()
4. python manage.py migrate 실행
5. django.core.exceptions.ImproperlyConfigured: mysqlclient 1.4.3 or newer is required; you have 1.0.2. 에러 발생..ㅎ
이걸 또 해결하기 위해 찾아보았더니 3번 코드 위에 이렇게 추가하니까 migrate가 해결되었다.
pymysql.version_info = (1, 4, 3, "final", 0)
pymysql.version_info = (1, 4, 3, "final", 0)
pymysql.install_as_MySQLdb()
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'test',
'USER': 'root',
'PASSWORD': '1234',
'HOST': 'localhost',
'PORT': '3306',
}
}
'IT > 프로그래밍' 카테고리의 다른 글
🛒 추천 상품
※ 이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- MySQL
- aws python3.12
- EC2
- python3.12 설치
- Firebase
- 슬랙으로 보내기
- ios pod install error
- google play appcheck
- 리눅스 python3 설치
- Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds
- NSPrivacyAccessedAPICategoryDiskSpace
- NSPrivacyAccessedAPICategoryUserDefaults
- Error (Xcode): Target release_unpack_ios failed: Exception: Binary
- 해결방법
- ios 앱 심사상태
- flutter build ipa
- Response: Failure when receiving data from the peer
- NSPrivacyAccessedAPICategoryFileTimestamp
- ITMS-91053: Missing API declaration
- 베란다 수경재배
- Xcode
- but linking in object file
- ios
- CDN: trunk URL couldn't be downloaded
- NSPrivacyAccessedAPICategorySystemBootTime
- 수경재배키트
- 아이폰
- com.google.android.gms.common.api.ApiException: 10:
- PlatformException(sign_in_failed
- Flutter
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
글 보관함