0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

django.db.utils.OperationalError: no such table: blog_postでつまる

Last updated at Posted at 2019-01-05

django,herokuで,デプロイする際,
以下のエラー
django.db.utils.OperationalError: no such table: blog_post

#解消法

.gitignore
myvenv
__pycache__
staticfiles
local_settings.py
db.sqlite3
*.py[co]

.gitignore
myvenv
__pycache__
staticfiles
local_settings.py
*.py[co]

に変更した結果,解決.

#他に試したこと

heroku run python manage.py makemigrations
heroku run python manage.py migrate
heroku run python manage.py createsuperuser

heroku run python manage.py createsuperuserあたりで,heroku上のデータベースにテーブルが存在していないことに気づく.
すると, .gitignore内, db.sqlite3が記述されていました...

他のサイトでも, .gitignoreを疑うべきとのコメントも見かけました.
https://stackoverflow.com/questions/3631556/django-no-such-table-django-session/3631620)
もしかしたら,.gitignoreを見直してみると糸口が見つかるかもしれないです!

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?