首先,我创建了我的数据库.
create database mydb;
Run Code Online (Sandbox Code Playgroud)
我在安装的应用程序中添加"南".然后,我转到本教程:http: //south.aeracode.org/docs/tutorial/part1.html
教程告诉我这样做:
$ py manage.py schemamigration wall --initial
>>> Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate wall
Run Code Online (Sandbox Code Playgroud)
好的,现在我迁移了.
$ py manage.py migrate wall
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误......
django.db.utils.DatabaseError: (1146, "Table 'fable.south_migrationhistory' doesn't exist")
Run Code Online (Sandbox Code Playgroud)
所以我使用谷歌(这永远不会奏效,因此问#2我的870度的问题.),我得到这个页面:http://groups.google.com/group/south-users/browse_thread/thread/d4c83f821dd2ca1c
好的,所以我按照说明进行操作
>> Drop database mydb;
>> Create database mydb;
$ rm -rf ./wall/migrations
$ py manage.py syncdb
Run Code Online (Sandbox Code Playgroud)
但是当我运行syncdb时,Django会创建一堆表.是的,它创建了south_migrationhistory表,但它也创建了我的应用程序表.
Synced:
> django.contrib.admin
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.messages
> south
> fable.notification
> …Run Code Online (Sandbox Code Playgroud) 我在我的一个Django模型中有一个DateTimeField.
completed_date = models.DateTimeField('date completed', blank=True, null=True)
Run Code Online (Sandbox Code Playgroud)
我已将其定义为允许空值和空值.但是,当我尝试创建模型的实例时,我收到以下错误:
/ admin/tasks/project/add /中的IntegrityError
tasks_project.completed_date可能不是NULL
我正在使用Django 1.25和Python 2.7.任何人都知道为什么会这样吗?有什么办法可以解决这个问题吗?