Python 表单轮询上的Django语法错误。模型导入
我正在使用window 7,我有Django 1.5和python 2.7,并试图使用给定的语法在自己的网站上运行Django示例,但当我运行命令时:>>>Python 表单轮询上的Django语法错误。模型导入,python,django,Python,Django,我正在使用window 7,我有Django 1.5和python 2.7,并试图使用给定的语法在自己的网站上运行Django示例,但当我运行命令时:>>>from polls.models import Poll,Choice我得到语法: Erro: G:\p\mysite>python manage.py shell Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win 32 T
from polls.models import Poll,Choice
我得到语法:
Erro: G:\p\mysite>python manage.py shell Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information.(InteractiveConsole)
>>> help Type help() for interactive help, or help(object) for help about object.
>>> form polls.models import Poll File "<console>", line 1
form polls.models import Poll
^ SyntaxError: invalid syntax
我是python新手,非常感谢您的帮助 这只是一个输入错误:使用
from
而不是表单这只是一个输入错误:使用from
而不是表单
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)