質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

2053閲覧

【Django】VPS上でmigrateできない

退会済みユーザー

退会済みユーザー

総合スコア0

Django

DjangoはPythonで書かれた、オープンソースウェブアプリケーションのフレームワークです。複雑なデータベースを扱うウェブサイトを開発する際に必要な労力を減らす為にデザインされました。

PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

Ubuntu

Ubuntuは、Debian GNU/Linuxを基盤としたフリーのオペレーティングシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2018/04/22 15:20

Djangoで作ったWEBサイトをさくらVPS上で公開しようとしたのですが、migrateができません。
VPSのOSは、Ubuntu serverで、データベースは、PostgreSQLを使用しています。
さくらVPS上では、venv環境を適用しており、必要となるものは全てインストールしていると思います。
python manage.py migrateをした場合のエラーは、添付のとおりです。

(testfields) testuser@ik1-315-17973:~/myproject/testfields$ python manage.py migrate
System check identified some issues:
WARNINGS:
?: (2_0.W001) Your URL pattern '^jet/' has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().
?: (urls.W005) URL namespace 'social' isn't unique. You may not be able to reverse all URLs in this namespace
Operations to perform:
Apply all migrations: admin, test, auth, contenttypes, jet, sessions, social_django
Running migrations:
Applying social_django.0005_auto_20160727_2333...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/core/management/init.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 200, in handle
fake_initial=fake_initial,
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/migration.py", line 112, in apply
operation.state_forwards(self.app_label, project_state)
File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/operations/models.py", line 514, in state_forwards
model_state = state.models[app_label, self.name_lower]
KeyError: ('social_django', 'association')

エラーの内容のコピーが長くなり申し訳ありません。
KeyError: ('social_django', 'association')というのが、何なのか分からず、もしどなたかお気づきの点がある方、見えましたら、ご教示頂ければ幸いです。
よろしくお願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

File "/home/testuser/myproject/testfields/lib/python3.5/site-packages/django/db/migrations/operations/models.py", line 514, in state_forwards
model_state = state.models[app_label, self.name_lower]
KeyError: ('social_django', 'association')

KeyError: ('social_django' ・・・ですから、Key、valueで考えば何となくわかります。
文字通り、Keyの値が不正、誤りということです。

Keyにsocial_djangoがくるのが、正しくないということですね。
social_djangoではなく、social_****ではないでしょうか?

その理由は
「Apply all migrations: admin, test, auth, contenttypes, jet, sessions, social_django」
という全範囲で処理していますから、そのどこかでコケている可能性があります。

Your URL pattern '^jet/' や  when migrating to django.urls.path() あたりを見ると、
sessionsまでの処理は終わっている? で、social_djangoでつまづいている?
それともauthでつまづいている?


(あとWARNINGS: も本来でないですね)
フォルダ構成、パス名の指定に問題があるのでは?

投稿2018/04/22 16:04

kawakawa2018

総合スコア1195

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問