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

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

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

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Django

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

Mecab

Mecabは、オープンソースの形態素解析エンジンです。 言語、辞書、コーパスに依存しない汎用的な設計を基本方針としています。 Mecabの由来は、開発者の好物である和布蕪(めかぶ)から名づけられました。

VPS

VPS(バーチャル・プライベート・サーバ)は、仮想化されたサーバをレンタルするサービスで、共有サーバでありながら専門サーバと同等の機能を果たします。物理的な専門サーバより安価で提供できるメリットがあります。

Q&A

0回答

936閲覧

ローカルで動くプログラムがVPS上で動かない

bunks

総合スコア30

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Django

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

Mecab

Mecabは、オープンソースの形態素解析エンジンです。 言語、辞書、コーパスに依存しない汎用的な設計を基本方針としています。 Mecabの由来は、開発者の好物である和布蕪(めかぶ)から名づけられました。

VPS

VPS(バーチャル・プライベート・サーバ)は、仮想化されたサーバをレンタルするサービスで、共有サーバでありながら専門サーバと同等の機能を果たします。物理的な専門サーバより安価で提供できるメリットがあります。

0グッド

0クリップ

投稿2018/10/09 14:07

MeCabを用いるDjangoアプリをさくらVPS(CentOS7)上にデプロイしようとしています。

以前,自らが行った質問(https://teratail.com/questions/150989)への回答を参考に,settings.pyにloggingの設定を加えたところ,以下のようなログが出ました。

ローカルでもVPSでも同じようになりますが,ローカルでは正常にプログラムが動きます。一方,VPSではcore dumpedとなり,ストップします。

下記のログが意味するところと,なぜVPSではうまく動かないのかご教授いただきたいです。
同時に,core dumpedとなる原因のエラーのログ表示の仕方も教えていただきたいです。調べてもgbcなどしか出ませんでした。

(前述の質問よりあまり発展ないこと,ご容赦ください。)

ErrorLog

1DEBUG 2018-10-09 22:45:08,900 base 29293 140146327054144 Exception while resolving variable 'urls' in template 'app/home.html'. 2Traceback (most recent call last): 3 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup 4 current = current[bit] 5 File "/usr/lib64/python3.6/site-packages/django/template/context.py", line 83, in __getitem__ 6 raise KeyError(key) 7KeyError: 'urls' 8 9During handling of the above exception, another exception occurred: 10 11Traceback (most recent call last): 12 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup 13 if isinstance(current, BaseContext) and getattr(type(current), bit): 14AttributeError: type object 'RequestContext' has no attribute 'urls' 15 16During handling of the above exception, another exception occurred: 17 18Traceback (most recent call last): 19 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup 20 current = current[int(bit)] 21ValueError: invalid literal for int() with base 10: 'urls' 22 23During handling of the above exception, another exception occurred: 24 25Traceback (most recent call last): 26 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup 27 (bit, current)) # missing attribute 28django.template.base.VariableDoesNotExist: Failed lookup for key [urls] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7f764b0b8d90>>, 'request': <WSGIRequest: GET '/'>, 'user': <SimpleLazyObject: <function AuthenticationMiddleware.process_request.<locals>.<lambda> at 0x7f76541b5ae8>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x7f764b08e160>, 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f764b0ab198>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'block': <Block Node: body. Contents: [<TextNode: '\n\n<div class="search_wind'>, <django.template.defaulttags.URLNode object at 0x7f764b085080>, <TextNode: '" method="get">\n '>, <django.template.defaulttags.URLNode object at 0x7f764b085160>, <TextNode: '" method="get">\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n\n</div>\n\n '>, <Block Node: content. Contents: [<TextNode: '\n '>]>, <TextNode: '\n'>]>}] 29DEBUG 2018-10-09 22:45:08,903 base 29293 140146327054144 Exception while resolving variable 'samples' in template 'app/home.html'. 30Traceback (most recent call last): 31 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup 32 current = current[bit] 33 File "/usr/lib64/python3.6/site-packages/django/template/context.py", line 83, in __getitem__ 34 raise KeyError(key) 35KeyError: 'samples' 36 37During handling of the above exception, another exception occurred: 38 39Traceback (most recent call last): 40 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup 41 if isinstance(current, BaseContext) and getattr(type(current), bit): 42AttributeError: type object 'RequestContext' has no attribute 'samples' 43 44During handling of the above exception, another exception occurred: 45 46Traceback (most recent call last): 47 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup 48 current = current[int(bit)] 49ValueError: invalid literal for int() with base 10: 'samples' 50 51During handling of the above exception, another exception occurred: 52 53Traceback (most recent call last): 54 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup 55 (bit, current)) # missing attribute 56django.template.base.VariableDoesNotExist: Failed lookup for key [samples] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7f764b0b8d90>>, 'request': <WSGIRequest: GET '/'>, 'user': <SimpleLazyObject: <function AuthenticationMiddleware.process_request.<locals>.<lambda> at 0x7f76541b5ae8>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x7f764b08e160>, 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f764b0ab198>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'block': <Block Node: body. Contents: [<TextNode: '\n\n<div class="search_wind'>, <django.template.defaulttags.URLNode object at 0x7f764b085080>, <TextNode: '" method="get">\n '>, <django.template.defaulttags.URLNode object at 0x7f764b085160>, <TextNode: '" method="get">\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n\n</div>\n\n '>, <Block Node: content. Contents: [<TextNode: '\n '>]>, <TextNode: '\n'>]>}] 57DEBUG 2018-10-09 22:45:08,903 base 29293 140146327054144 Exception while resolving variable 'your_name' in template 'app/home.html'. 58Traceback (most recent call last): 59 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 829, in _resolve_lookup 60 current = current[bit] 61 File "/usr/lib64/python3.6/site-packages/django/template/context.py", line 83, in __getitem__ 62 raise KeyError(key) 63KeyError: 'your_name' 64 65During handling of the above exception, another exception occurred: 66 67Traceback (most recent call last): 68 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup 69 if isinstance(current, BaseContext) and getattr(type(current), bit): 70AttributeError: type object 'RequestContext' has no attribute 'your_name' 71 72During handling of the above exception, another exception occurred: 73 74Traceback (most recent call last): 75 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 843, in _resolve_lookup 76 current = current[int(bit)] 77ValueError: invalid literal for int() with base 10: 'your_name' 78 79During handling of the above exception, another exception occurred: 80 81Traceback (most recent call last): 82 File "/usr/lib64/python3.6/site-packages/django/template/base.py", line 850, in _resolve_lookup 83 (bit, current)) # missing attribute 84django.template.base.VariableDoesNotExist: Failed lookup for key [your_name] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7f764b0b8d90>>, 'request': <WSGIRequest: GET '/'>, 'user': <SimpleLazyObject: <function AuthenticationMiddleware.process_request.<locals>.<lambda> at 0x7f76541b5ae8>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x7f764b08e160>, 'messages': <django.contrib.messages.storage.fallback.FallbackStorage object at 0x7f764b0ab198>, 'DEFAULT_MESSAGE_LEVELS': {'DEBUG': 10, 'INFO': 20, 'SUCCESS': 25, 'WARNING': 30, 'ERROR': 40}}, {}, {'block': <Block Node: body. Contents: [<TextNode: '\n\n<div class="search_wind'>, <django.template.defaulttags.URLNode object at 0x7f764b085080>, <TextNode: '" method="get">\n '>, <django.template.defaulttags.URLNode object at 0x7f764b085160>, <TextNode: '" method="get">\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n <br>\n <br>\n '>, <IfNode>, <TextNode: '\n\n</div>\n\n '>, <Block Node: content. Contents: [<TextNode: '\n '>]>, <TextNode: '\n'>]>}]

該当箇所のHTMLは以下の通りで,ビューやモデルについては上述のこちらを参照していただけるとありがたいです。

html

1 {% if urls %} 2 {% for url in urls%} 3 <li><a href = '{{url}}'>{{url}}</a></li> 4 {% endfor %} 5 {% endif %} 6 <br> 7 <br> 8 {% if samples %} 9 「素材となる文章」<br> 10 {{ samples }} 11 {% endif %} 12 <br> 13 <br> 14 {% if your_name %} 15 「生成された文章」<br> 16 {{ your_name }} 17 {% endif %}

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問