close

整理在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'

ANS: https://stackoverflow.com/questions/56820895/migrations-error-in-django-2-attributeerror-str-object-has-no-attribute-dec

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'",
        },



    }
}

 

 

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 liusming 的頭像
    liusming

    劉老師的跨域創想工坊

    liusming 發表在 痞客邦 留言(0) 人氣()