整理在MAC OS上用pycharm實作在DOCKER以MYSQL CONTAINER來建構過程。
- 遭遇問題/解決方法
Q1. django2.2版本中pymysql报错'mysqlclient 1.3.13 or newer is required':
ANS: https://blog.csdn.net/lijing742180/article/details/91966031
Q2. Did you install mysqlclient?
ANS:https://www.jianshu.com/p/82781add8449
Q3. AttributeError: 'str' object has no attribute 'decode'
or https://blog.csdn.net/lijing742180/article/details/91966031
- 檔案資料
MySQL image : https://hub.docker.com/_/mysql 版本5.6 expose 3306
修改Django setting.py 中的Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'USER':'root',
'PASSWORD':'123456',
'HOST':'0.0.0.0',
'PORT':'3306',
'OPTIONS':{
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
},
}
}
請先 登入 以發表留言。