3.django connect MySQL database and install MYSQLDB driver error Resolution

Source: Internet
Author: User
Tags virtual environment

1. Setting up a connection database in setting.py

    • DATABASES = {
      ' Default ': {
      ' ENGINE ': ' Django.db.backends.mysql ',
      ' NAME ': ' djangotest ',
      ' USER ': ' Root ',
      ' PASSWORD ': ' Root ',
      ' HOST ': ' 127.0.0.1 ',
      ' PORT ': ' 3306 '
      }
      }
    • When using migrate to generate the data table will be prompted not to connect to the MYSQLDB driver, then need to install the driver
    • Pip install Mysql-python, installed in the Windows environment, many will appear error:microsoft Visual C + + 9.0 is required error.
    • The general explanation on the web is that reinstalling MySQL and installing MySQL is the option to install C + + compilers ...

      I have not tried, but it certainly does not work ah, I just want to install a python can be remotely connected to the MySQL package, tube local MySQL what? Some explanations are really fraught.

      But in the error hints also thanks to the lack of C + + environment, and later found on the Internet method:
      Here's how:

      1. In http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python download the corresponding package version, if it is Win7 64 bit 2.7 version of Python, download

      Mysql_python-1.2.5-cp27-none-win_amd64.whl

      2. Enter the download directory in the virtual environment, using PIP installation, such as:

3.django connect MySQL database and install MYSQLDB driver error Resolution

Related Article

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.