Using the MySQL database in Django virtualenv, python 3.5 django1.10 MySQL 5.7.17

Source: Internet
Author: User
Tags django virtualenv virtual environment virtualenv

--python3.5
--django1.10
--mysql5.7.17
Three drivers are recommended on official documents
MySQLdb
Mysqlclient
MySQL Connector/python

The first one does not support 3.x PIP3 installed, error missing module Configparser
Some people say that because the module changed the name, changed to Configparser, CP one can, but tried, no, or said no module

Try using Mysqlclient,
PIP3 Install Mysqlclient
It worked
It is possible not to use a virtual environment
But in the virtual environment download will fail, will say that the lack of mysql_config
According to StackOverflow's statement,
Environment variables are configured
Download Mysql-python, uh, back again no Configparser
Check the pipy, not support 3.x ...

The last MySQL official of that, also no, virtual environment will say no MYSQLDB
Try to follow the following ideas, modify the __init__, find the method in the module, did not find which can be used


Pymysql can be used in virtualenv virtual environments
You need to modify the __init__ file under the project
Add to
Import Pymysql
Pymysql.install_as_mysqldb ()

Thanks http://www.maiziedu.com/article/8272/
After the article said that need to pymysql on GitHub, no longer, direct PIP can start normally

Using the MySQL database in Django virtualenv, python 3.5 django1.10 MySQL 5.7.17

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.