标签:int ros ken 64 bit ons 手动 orm 安装 rom
安装MySQL_python-1.2.5-cp27-none-win_amd64.whl
2. pip install MySQL_python-1.2.5-cp27-none-win_amd64.whl
3. pip freeze 查看
‘django.db.backends.mysql‘‘django.db.backends.sqlite3‘‘django.db.backends.oracle‘
DATABASES = {
‘default‘: {‘ENGINE‘: ‘django.db.backends.sqlite3‘,‘NAME‘: os.path.join(BASE_DIR, ‘db.sqlite3‘),}}
3) mysql 的配置
‘default‘: {
‘ENGINE‘: ‘django.db.backends.mysql‘,‘NAME‘: ‘web_django‘,‘USER‘: ‘root‘,‘PASSWORD‘: ‘root‘,‘HOST‘: ‘127.0.0.1‘, # Set to empty string for localhost. Not used with sqlite3.‘PORT‘: ‘3306‘, # Set to empty string for default 3306. Not used with sqlite3.
}
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.(InteractiveConsole)>>> from django.db import connection>>> connection.cursor()<django.db.backends.utils.CursorDebugWrapper object at 0x0000000003C508D0>
INSTALLED_APPS = [‘django.contrib.admin‘,‘django.contrib.auth‘,‘django.contrib.contenttypes‘,‘django.contrib.sessions‘,‘django.contrib.messages‘,‘django.contrib.staticfiles‘,‘web‘,]
3. 在app的models.py文件中创建models子类
# -*- coding: utf-8 -*-from __future__ import unicode_literalsfrom django.db import modelsclass UserInfo(models.Model):userName = models.CharField(max_length=50)passWord = models.CharField(max_length=50)
python manage.py makemigratioinspython manage,py migrate
from __future__ import unicode_literalsfrom django.db import modelsclass UserInfo(models.Model):userName = models.CharField(max_length=50)passWord = models.CharField(max_length=50)createDate = models.DateField()执行: python manage.py makemigratioins并输入:1输入:timezone.now执行:python manage.py migrate
标签:int ros ken 64 bit ons 手动 orm 安装 rom
原文地址:http://www.cnblogs.com/PythonHomePage/p/7634383.html