Djangoで作ったアプリをWeb上にデプロイしようとしています。
Djangoのバージョンは1.8.4、Pythonのバージョンは2.7.6です。
さくらインターネットのレンタルサーバです。
基本的に、さくらのレンタルサーバでDjangoを動かしてみたを参考にしました。
やってきたことは、
1.Djangoをインストールした後にパスが通るようにするため、$HOME/.cshrc へ設定追加
2.Djangoをインストール
3..htaccessを作成
しかし、500 Internal Server Errorが出てしまい、その対応に苦慮しております。
Webサーバーのエラーログの内容は、下記のとおりです。
No handlers could be found for logger "django.request" Traceback (most recent call last): File "django.cgi", line 100, in <module> run_with_cgi(django.core.handlers.wsgi.WSGIHandler()) File "django.cgi", line 85, in run_with_cgi result = application(environ, start_response) File "/home/username/.local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__ response = self.get_response(request) File "/home/username/.local/lib/python2.7/site-packages/django/core/handlers/base.py", line 218, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/username/.local/lib/python2.7/site-packages/django/core/handlers/base.py", line 261, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/home/username/.local/lib/python2.7/site-packages/django/views/debug.py", line 97, in technical_500_response html = reporter.get_traceback_html() File "/home/username/.local/lib/python2.7/site-packages/django/views/debug.py", line 384, in get_traceback_html return t.render(c) File "/home/username/.local/lib/python2.7/site-packages/django/template/base.py", line 209, in render return self._render(context) File "/home/username/.local/lib/python2.7/site-packages/django/template/base.py", line 201, in _render return self.nodelist.render(context) File "/home/username/.local/lib/python2.7/site-packages/django/template/base.py", line 903, in render bit = self.render_node(node, context) File "/home/username/.local/lib/python2.7/site-packages/django/template/debug.py", line 79, in render_node return node.render(context) File "/home/username/.local/lib/python2.7/site-packages/django/template/debug.py", line 89, in render output = self.filter_expression.resolve(context) File "/home/username/.local/lib/python2.7/site-packages/django/template/base.py", line 674, in resolve new_obj = func(obj, *arg_vals) File "/home/username/.local/lib/python2.7/site-packages/django/template/defaultfilters.py", line 779, in date return format(value, arg) File "/home/username/.local/lib/python2.7/site-packages/django/utils/dateformat.py", line 345, in format return df.format(format_string) File "/home/username/.local/lib/python2.7/site-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/home/username/.local/lib/python2.7/site-packages/django/utils/dateformat.py", line 270, in r return self.format('D, j M Y H:i:s O') File "/home/username/.local/lib/python2.7/site-packages/django/utils/dateformat.py", line 37, in format pieces.append(force_text(getattr(self, piece)())) File "/home/username/.local/lib/python2.7/site-packages/django/utils/encoding.py", line 92, in force_text s = six.text_type(s) File "/home/username/.local/lib/python2.7/site-packages/django/utils/functional.py", line 141, in __text_cast return func(*self.__args, **self.__kw) File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 84, in ugettext return _trans.ugettext(message) File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 327, in ugettext return do_translate(message, 'ugettext') File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 304, in do_translate _default = _default or translation(settings.LANGUAGE_CODE) File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 206, in translation _translations[language] = DjangoTranslation(language) File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 116, in __init__ self._add_installed_apps_translations() File "/home/username/.local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 164, in _add_installed_apps_translations "The translation infrastructure cannot be initialized before the " django.core.exceptions.AppRegistryNotReady: The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time. Premature end of script headers: django.cgi
Deploying django app: AppRegistryNotReady: The translation infrastructure cannot be initialized
に、
In your wsgi file change the last line to :
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
という記述があったので、
wsgi.pyの最終行にそれを記述してみたのですが、効果はありませんでした。
どこが誤っているでしょうか。
可能性でも結構ですので、お分かりの方、ご教示頂ければ幸いです。よろしくお願いいたします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。