简体   繁体   中英

connect django to mysql on shared hosting

I want to use mysql server in my django project and this was my database setting:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        ...
    }
}

but this engine needs mysqlclient and i can't install it on shared host. because i need superuser access to fix some issues.

So i decided to use:

DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        ...
    }
}

however, this engine has some bugs!! when i wanna get a row from database, it doesn't return boolean columns(return None instead).

now i want to know if there is another engine for this or any other idea to solve it??

django==2.0 python==3.6

I could solve it:

DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        ...
        'OPTIONS':{
                    'use_pure':True
                  }
               }
            }

it will use pure engine instead of c-extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM