django:数据库修改工具South的正确使用方式
如果你在使用south,然而并没有遇到本文所提到的错误,我则建议你跳到本文的第三部分看一看,我想ken的详尽建议可能对你也会有所帮助。
1 什么是south
由于django 的syncdb只能在数据库创建的时候发挥作用,而对Model进行更改之后再运行syncdb是不能将更改反映到数据库中的。只能就要自己使用其他原始而蹩脚的方式进行修改操作。south就是解决这个问题的工具。
2 遵守south手册带来的错误
你也许按照south手册的要求,进行了以下操作:
1)首先创建了一个数据库
create database mydb;
2)然后把“south”放在settings.py中的INSTALLED_APPS 然后在console中执行以下命令
$ python manage.py schemamigration wall --initial
这步没问题
$ python manage.py migrate wall
这条命令则报出了以下错误
?
< SPAN style = "BACKGROUND-COLOR: #c0c0c0" >Skipping creation of NoticeTypes as notification app not found Running migrations for profiles: - Migrating forwards to 0002_auto__add_field_interest_created_on__add_field_profile_created_on__add. > profiles:0001_initial south execute "CREATE TABLE "profiles_profile" ("id" integer NOT NULL PRIMARY KEY, "user_id" integer NOT NULL UNIQUE, "first_name" varchar(30) NOT NULL, "last_name" varchar(30) NOT NULL, "location" varchar(255) NOT NULL, "image" varchar(100) NOT NULL, "bio" text NOT NULL);" with params "[]" Traceback (most recent call last): File "manage.py", line 26, in < module > execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 220, in execute output = self.handle(*args, **options) File "/Library/Python/2.6/site-packages/south/management/commands/migrate.py", line 105, in handle ignore_ghosts = ignore_ghosts, File "/Library/Python/2.6/site-packages/south/migration/__init__.py", line 191, in migrate_app success = migrator.migrate_many(target, workplan, database) File "/Library/Python/2.6/site-packages/south/migration/migrators.py", line 221, in migrate_many result = migrator.__class__.migrate_many(migrator, target, migrations, database) File "/Library/Python/2.6/site-packages/south/migration/migrators.py", line 292, in migrate_many result = self.migrate(migration, database) File "/Library/Python/2.6/site-packages/south/migration/migrators.py", line 125, in migrate result = self.run(migration) File "/Library/Python/2.6/site-packages/south/migration/migrators.py", line 99, in run return self.run_migration(migration) File "/Library/Python/2.6/site-packages/south/migration/migrators.py", line 81, in run_migration
上一个:数据库范式那些事
访问www.zzzyk.com 试试 CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络, |