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 %}
あなたの回答
tips
プレビュー