"Fix" Django project abandoned SQLite3 embrace MySQL

Source: Internet
Author: User

SQLite3 database on a file, copied at any time to take away, debugging convenient, super lightweight, has its benefits.

However, MySQL is the mainstream of small and medium-sized projects, recently wanted to deploy the Django Milestone project to the SAE, so try to replace the original project database with MySQL, the recording process is as follows.

  • Install the interface for Python and MySQL

URL for http://www.lfd.uci.edu/~gohlke/pythonlibs/, this dick, basically Python plugin library have, I use the python2.7, so download Mysql?python?1.2.5.win32? Py2.7.exe, and installed;

Under the Python command line import _mysql,import mysqldb (note: case sensitive) are successful, the installation is successful!

  • Install MySQL

Directly installed Wamp, this integrated mysql,php,apache and so on, very convenient things.

Build the database in MySQL, here I build the Myenrich database based on the project (preferably with the character set, coding problem annoying dead)!

  • Configure setting.py

No nonsense,

  

  • modifying character sets

Django's original code is not changed, thank goodness, too convenient, moved to cry. But a run, the problem comes, the fucking can't insert Chinese ah, this is the database problem.

For a long while, tried a lot of methods, the database character set to change is not good.

Finally, the character set of this table is changed so that, "ALTER table xxx CONVERT to CHARACTER SET UTF8;"

Details Visible: http://blog.sina.com.cn/s/blog_4de067e40100ebvm.html

But I want to be a lot of tables what to do ... Before the database was built with the character set, it should be possible, I have not tried.

"Fix" Django project abandoned SQLite3 embrace MySQL

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.