我正在阅读 Django 教程:https ://docs.djangoproject.com/en/1.5/intro/tutorial01/
我有一个错误:
TypeError:
__init__()
得到了一个意外的关键字参数“默认”
当我打电话时会发生这种情况:
$python manage.py sql polls
或者
$python manage.py syncdb
我被卡住了,无法弄清楚我做错了什么。
我刚开始教程的“激活模型”部分并输入已安装的应用程序
引用:[settings.py]
'Engine': 'django.db.backends.sqlite3'
'NAME': '/Users/msmith/Documents/djangoPractice/database.db'
$ python manage.py syncdb
$ python manage.py startapp polls
[民意调查.models.py]
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(Default=0)
[settings.py] - 在列表底部添加了“民意调查”
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'polls',
)
$python manage.py sql polls -> 发生错误