django 的mysql数据配置

原地址:http://blog.csdn.net/gamesofsailing/article/details/21465327

在成功安装python-mysql后,开始配置django的mysql连接配置

打开django项目下的setting.py文件,将DATABASES改成下面这样

DATABASES = {

      'default': {

          'ENGINE':'django.db.backends.mysql',

         'NAME':'mysite',

         'USER':'root',

          'PASSWORD':'',

          'HOST':'127.0.0.1',

          'PORT':'3306',

      }

  }

最后运行:

python mange.py dbshell

成功进入mysql shell

[plain] view plaincopy在CODE上查看代码片派生到我的代码片
 
  1. mylittlefishdeMacBook-Air:mysite mylittlefish$ python manage.py dbshell  
  2. Welcome to the MySQL monitor.  Commands end with ; or g.  
  3. Your MySQL connection id is 5  
  4. Server version: 5.6.16 MySQL Community Server (GPL)  
  5.   
  6. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.  
  7.   
  8. Oracle is a registered trademark of Oracle Corporation and/or its  
  9. affiliates. Other names may be trademarks of their respective  
  10. owners.  
  11.   
  12. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.  
  13.   
  14. mysql>   
原文地址:https://www.cnblogs.com/123ing/p/3903377.html