我學習Django教程,當我運行控制檯命令時出現一些奇怪的錯誤。 0001_initial.py未在遷移文件夾中創建。Django 1.7 python manage.py makemigrations民意調查
python manage.py makemigrations polls
C:\Users\pc\Dropbox\ГуглДрайв\python\projects\pools\mysite> python manage.py makemigrations polls
Migrations for 'polls':
0001_initial.py:
- Create model Choice
- Create model Question
- Add field question to choice
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\__init__.py", lin
rom_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\__init__.py", lin
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\base.py", line 28
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\base.py", line 33
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\commands\makemigr
4, in handle
self.write_migration_files(changes)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\management\commands\makemigr
3, in write_migration_files
migrations_directory = os.path.dirname(writer.path)
File "C:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\db\migrations\writer.py", line 21
return os.path.join(basedir, self.filename)
File "C:\Python27\lib\ntpath.py", line 84, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18: ordinal not in range(128)
Whatw wrong?
這是民意調查的文件夾
# -- coding: utf-8 -
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
1)你創建一個默認的數據庫ut8編碼? 2)你是否在模型的頂部添加了# - * - coding:utf-8 - * - ? – 2014-12-07 10:01:09
嗨,邁克!我不知道 - 我使用默認的SQLlite基地 – imxoo 2014-12-07 10:09:10
你的python解釋器的版本是什麼? – iMom0 2014-12-07 10:17:45