After successfully installing PYTHON-MYSQL, start configuring the Django MySQL connection configuration
VI settings.py
Modify
DATABASES = {
' Default ': {
' ENGINE ': ' Django.db.backends.sqlite3 ',
' NAME ': Os.path.join (Base_dir, ' db.sqlite3 '),
}
}
For
DATABASES = {
' Default ': {
' ENGINE ': ' Django.db.backends.mysql ',
' NAME ': ' CC ',
' USER ': ' CC ',
' PASSWORD ': ' cc123456 ',
' HOST ': ' localhost ',
' PORT ': ' 3306 ',
}
}
And then
Python manage.py Dbshell
Cases:
[email protected] cc]# python manage.py Dbshell
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 194
Server Version:5.5.36-log Source Distribution
Copyright (c), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Build the Books app under CC projects
Python manage.py Startapp Books
How to configure MySQL parameters in Python Django