존재하지 않습니다 이것은 내가 뭘했는지 있습니다 : 로컬문제는 장고 사우스 사용 Heroku가에 설치하기 - ProgrammingError가 계속 : 관계가
- 나는 새로운 포스트 그레스 데이터베이스를 가지고, 2 개 개의 모델 .py 파일 두 가지 다른 응용 프로그램에서 :
python manage.py syncdb
python manage.py schemamigration api --initial
python manage.py schemamigration extapi --initial
python manage.py migrate api 0001 --fake
python manage.py migrate extapi 0001 --fake
이 작품은 팽창, 그리고 데이터베이스에 물건을 잘 추가 할 수 있습니다. 그런 다음
, 이미 빈 응용 프로그램 만든 Heroku가,에 밀어 때
git add .
git commit -m "Ready to go to Heroku"
git push heroku master
heroku run python manage.py syncdb
이 출력 :
Running `python manage.py syncdb` attached to terminal... up, run.9548
Syncing...
Creating tables ...
Creating table django_admin_log
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table south_migrationhistory
# create superuser prompt...
Superuser created successfully.
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
> rest_framework
Not synced (use migrations):
- api
- extapi
가 그럼 난 heroku run python manage.py migrate
로하는 애플리케이션을 마이그레이션하고 가려고을 이 오류 :
Running `python manage.py migrate` attached to terminal... up, run.3724
Running migrations for api:
- Migrating forwards to 0001_initial.
> api:0001_initial
FATAL ERROR - The following SQL query failed: ALTER TABLE "api_song" ADD CONSTRAINT "summary_id_refs_id_36bb6e06" FOREIGN KEY ("summary_id") REFERENCES "extapi_summary" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: relation "extapi_summary" does not exist
Error in migration: api:0001_initial
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/migrators.py", line 329, in migrate_many
result = self.migrate(migration, database)
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration, database)
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
return self.run_migration(migration, database)
File "/app/.heroku/python/lib/python2.7/site-packages/south/migration/migrators.py", line 85, in run_migration
south.db.db.execute_deferred_sql()
File "/app/.heroku/python/lib/python2.7/site-packages/south/db/generic.py", line 318, in execute_deferred_sql
self.execute(sql)
File "/app/.heroku/python/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "extapi_summary" does not exist
나에게 테이블은 단지 cr eated, 그러나 나는 왜 모른다. heroku run python manage.py sqlall
을 실행하면 모든 것이 만들어 졌다고 표시되지만 데이터베이스 자체를 보게됩니다 (heroku가 s3에서 만듭니다). app_one 및 app_two에는 아무 것도 없습니다. 다시 말하지만,이 모든 작업은 로컬에서 완벽하게 작동합니다. 즉, 상황이 무너지는 것은 영웅에 올라갈 때입니다.
'./manage.py migrate extapi'를 실행하고'./manage.py migrate'를 실행하면 어떻게됩니까? –
'heroku run ./manage.py migrate extapi'를 실행 한 후'django.db.utils.ProgrammingError : relation "api_userprofile이 존재하지 않습니다. 현재 extapi.models 상단에'from api.models import UserProfile' 가져 오기가 있습니다. 수입품을 바꾸려고 할거야 ... –
그래, 같은 문제 야. –