前提・実現したいこと
DjangoでWEBサービスを開発しています。
modelにあるカラムを追加したく、ローカルで開発したのですが、Heroku環境にアップしたところ、エラーが出てしまい、質問させていただきます。
特定のmodelに特定のfieldを追加したところ、Heroku環境でのみserver error が出るようになりました。
errorになるのは、該当のmodelが関連するページのみで、ForeignKey などで参照しているページも同様でした。
adminページも同様で、該当のmodelに関わるところのみerrorが返ってきます。
原因の追及にやるべきことや、確認すべきこと、追記すべき情報などございましたら、
ご教示いただけますと幸いです。
発生している問題・エラーメッセージ
2019-05-05T07:04:14.483661+00:00 heroku[router]: at=info method=GET path="/admin/lessons/lesson/" host=www.uminekomanga.com request_id=49bcf59b-e704-4a4d-895f-214cffbabdc8 fwd="126.34.125.45" dyno=web.1 connect=1ms service=43ms status=500 bytes=234 protocol=https 2019-05-05T07:04:14.482471+00:00 app[web.1]: 10.45.48.79 - - [05/May/2019:16:04:14 +0900] "GET /admin/lessons/lesson/ HTTP/1.1" 500 27 "https://www.uminekomanga.com/admin/lessons/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36"
該当のソースコード
python
1models.py 該当のmodel 2 3class Lesson(models.Model): 4 title = models.CharField(max_length=255, blank=False, unique=True) 5 text = models.TextField() 6 user = models.ForeignKey( 7 settings.AUTH_USER_MODEL, 8 on_delete=models.PROTECT, 9 ) 10 tag = TaggableManager() 11# 追加したprice field 12# price = models.IntegerField( 13# verbose_name="Price", 14# choices=PRICE_CHOICES, 15# default=7000, blank=True, null=True, ) 16 sheet = CloudinaryField('lesson sheet pdf', blank=True, null=True,) 17 excercises = models.ManyToManyField(Excercise, blank=True) 18 lesson1 = models.TextField(blank=True, null=True,) 19 lesson2 = models.TextField(blank=True, null=True,) 20 lesson3 = models.TextField(blank=True, null=True,) 21 created_at = models.DateTimeField(auto_now_add=True) 22 updated_at = models.DateTimeField(auto_now=True) 23
試したこと
1 requirement.txt も念の為再作成しました。
2 templateやViewなど、他の変更点も、同時にアップしていたため、ロールバックし、modelの変更のみを加えてデプロイし直したところ、
やはり同様のエラーが発生いたしました。
3 herokuのテーブルを確認したところ、下記になっていました。(ロールバック後です)
Table "public.lessons_lesson"
Column | Type | Collation | Nullable | Default
------------+--------------------------+-----------+----------+--------------------------------------------
id | integer | | not null | nextval('lessons_lesson_id_seq'::regclass)
title | character varying(255) | | not null |
text | text | | not null |
sheet | character varying(100) | | |
lesson1 | text | | |
lesson2 | text | | |
lesson3 | text | | |
created_at | timestamp with time zone | | not null |
updated_at | timestamp with time zone | | not null |
user_id | integer | | not null |
4 debug=True でherokuにデプロイすると、サーバーエラーになるという情報を見たため、
herokuでのdebugはできていません。何か確認する方法があればご教示頂けますと幸いです。
https://lazycat99.hatenablog.com/entry/2019/01/05/201816
補足情報(FW/ツールのバージョンなど)
Django Version: 2.1.4
Python Version: 3.7.2
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。