我在win7上用pycharm 3和python/django在可移植环境中开发。我决定尝试将postgresql添加到我的项目(“rob1”)中,它位于我的virtualenv“R1”中,我使用了http://sourceforge.net/projects/pgsqlportable/
我是第一次和南方合作。在
我换了模型,保存了我的工作然后跑了:
$ ./manage.py schemamigration MYAPP--auto
- Deleted field date on getPost.Url
Created 0005_auto__del_field_url_date.py. You can now apply this migration with: ./manage.py migrate MYAPP
但当我跑的时候:
^{pr2}$我得到了一个很长的回溯,结尾是:
django.db.utils.ProgrammingError: no existe la relación «south_migrationhistory»
LINE 1: ...gration", "south_migrationhistory"."applied" FROM "south_mig...
我的postgres控制台显示:
ERROR: no existe la relación «south_migrationhistory» en carácter 154
SENTENCIA: SELECT "south_migrationhistory"."id", "south_migrationhistory"."app_
name", "south_migrationhistory"."migration", "south_migrationhistory"."applied"
FROM "south_migrationhistory" WHERE "south_migrationhistory"."applied" IS NOT NU
LL ORDER BY "south_migrationhistory"."applied" ASC
LOG: no se pudo recibir datos del cliente: No connection could be made because
the target machine actively refused it.
这些变化不会反映在postgres表中。我该怎么解决这个问题?在
编辑:
$ ./manage.py syncdb
Syncing...
Creating tables ...
Creating table south_migrationhistory
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
Synced:
> django.contrib.admin
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.messages
> django.contrib.staticfiles
> south
Not synced (use migrations):
- getPost
(use ./manage.py migrate to migrate these)
(r1)
$ ./manage.py migrate getPost
Running migrations for getPost:
- Migrating forwards to 0005_auto__del_field_url_date.
> getPost:0001_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE "getPost_poll" ("id" serial NOT NULL PRIMARY KEY, "question" varchar(200) NOT NULL, "pub_date" timestamp with
time zone NOT NULL)
The error was: la relación «getPost_poll» ya existe
Error in migration: getPost:0001_initial
我看你离我越来越近了。。还有什么建议吗?在
表
south_migrationhistory
似乎不存在。您需要运行manage.py syncdb
一次,然后才能使用south迁移。在对于每个已应用迁移的应用程序,
south_migrationhistory
将持续存在。如果将现有应用程序转换为south,则初始迁移应与当前架构状态匹配,例如,在创建初始迁移之前,不应进行任何模型更改。然后,要使south_migrationhistory
表与架构状态匹配,可以“假应用”初始迁移:这将在
^{pr2}$south_migrationhistory
表中创建初始迁移的记录,而不实际尝试进行任何模式更改。现在,您可以应用其余的迁移:相关问题 更多 >
编程相关推荐