2012-03-22 10 views
0

私はapache2で動作するアプリケーションを持っています。私はuwsgiに切り替えることを望みます。このアプリケーションは2年ぶりのApache上で動作するため、真のofcourseのではない - がないモジュール名ビュー:私のようなランダムエラーと派手な問題に直面している展開後 :wsgi djangoとrandom 500

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 272, in __call__ 
30928-    response = self.get_response(request) 
30929-  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 169, in get_response 
30930-    response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) 
30931-  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 218, in handle_uncaught_exception 
30932-    return callback(request, **param_dict) 
30933-  File "/var/www/fancy_site/releases/current/fancy_site/utils/views.py", line 699, in server_error 
30934-    'GIGYA_API_KEY':settings.GIGYA_API_KEY, 
30935-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 123, in render 
30936-    return self._render(context) 
30937-  File "/usr/local/lib/python2.6/dist-packages/django/test/utils.py", line 60, in instrumented_test_render 
30938-    return self.nodelist.render(context) 
30939-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 744, in render 
30940-    bits.append(self.render_node(node, context)) 
30941-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 757, in render_node 
30942-    return node.render(context) 
30943-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py", line 105, in render 
30944-    compiled_parent = self.get_parent(context) 
30945-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py", line 102, in get_parent 
30946-    return get_template(parent) 
30947-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 157, in get_template 
30948-    template, origin = find_template(template_name) 
30949-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 134, in find_template 
30950-    source, display_name = loader(name, dirs) 
30951-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 42, in __call__ 
30952-    return self.load_template(template_name, template_dirs) 
30953-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 48, in load_template 
30954-    template = get_template_from_string(source, origin, template_name) 
30955-  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 168, in get_template_from_string 
30956-    return Template(source, origin, name) 
30957-  File "/usr/local/lib/python2.6/dist-packages/debug_toolbar/panels/template.py", line 37, in new_template_init 
30958-    old_template_init(self, template_string, origin, name) 
30959-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 108, in __init__ 
30960-    self.nodelist = compile_string(template_string, origin) 
30961-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 136, in compile_string 
30962-    return parser.parse() 
30963-  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 239, in parse 
30964-    compiled_result = compile_func(self, token) 
30965-  File "/usr/local/lib/python2.6/dist-packages/django/template/defaulttags.py", line 1054, in load 
30966-    (taglib, e)) 
30967-django.template.base.TemplateSyntaxError: 'sso_token' is not a valid tag library: Template library sso_token not found, tried django.templatetags.sso_token,django.contrib.admin.templatetags.sso_token,django.contrib.webdesign.templatetags.sso_token,paging.templatetags.sso_token,sentry.templatetags.sso_token,tinymce.templatetags.sso_token,pagination.templatetags.sso_token,rosetta.templatetags.sso_token,flatblocks.templatetags.sso_token,oembed.templatetags.sso_token,debug_toolbar.templatetags.sso_token,memcache_status.templatetags.sso_token,mailchimp.templatetags.sso_token 

Djangoは私のようなメールに似た例外を送ります)

私はどこに問題があるのか​​わかりません - 私は自分の段階で複製できないことを知っています。これはクローン生産マシンです。私が知る限り、コードに依存するエラーやアプリケーションの問題ではありません。私は、現在の構成を使用していますprocutionで

を私が使用しています: ジャンゴ1.3.1 uWSGI 1.1 nginxの1.0.12-1〜 dotdeb.0のpython 2.6 のDebian 6.0.3 ×2をQC Xeon E5540 with 8 GB RAM

これらのマシンは、ホスティング会社によってサポートされている物理的なロードバランサの下にあります。

nginxののCFG:

server { 
 listen 80; 
       server_name www.fancy_site.fancy_domain fancy_site.fancy_domain 
       server_name_in_redirect off; 
       access_log /path/to/file.log; 

       if ($host = 'fancy_site') { 
           rewrite ^/(.*)$ http://www.fancy_site.fancy_domain/$1 permanent; 
       } 

       location /media/ { 
           alias /path/to/media/; 
           expires max; 
       } 

       location  /site_media/ { 
           alias /path/to/media/; 
           expires max; 
       } 

       location /static/ { 
           alias   /path/to/static/; 
           expires max; 
       } 

       gzip  on; 
       gzip_http_version 1.0; 
       gzip_vary on; 
       gzip_comp_level 3; 
       gzip_proxied any; 
       gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 
       gzip_buffers 16 8k; 
       gzip_disable “MSIE [1-6].(?!.*SV1)”; 

       location/{ 
           uwsgi_pass unix://path/to/uwsgi.socket; 
           include uwsgi_params; 
       } 

} 

uWSGI CFG:

prefix = /path/to/prod_direcotry 
master = true 
processes = 80 
uid = fancy_application 
gid = www-data 
memory-report = true 
max-requests = 800 
stdout_logfile = /path/to/uwsgi.log 
daemonize = /path/to/uwsgi.log 
redirect_stderr = true 
logfile-chown=www-data 
socket = /path/to/uwsgi.socket 
chdir = /path/to/application_direcotry 
pythonpath = /path/to/to_current_release_of_application 
env = DJANGO_SETTINGS_MODULE=application_direcotry.settings 
module = django.core.handlers.wsgi:WSGIHandler() 
touch-reload = %(prefix)/touch_to_restart 

誰かが同じまたは類似の問題があった場合、私はあなたのコミュニティをお願いしたいと思います。多分誰かが解決し、どのように共有したいですか?

よろしく ルカシュ

答えて

1

あなたが他のエラーを見ている場合を除き、あなたが最も可能性が高いことが原因が何であるか本当にだとしてあなたが取得し、エラーを理解しようとすべきです。

あなたの場合、(sso_tokenという名前の)templatetagsライブラリがありません。ほとんどの場合、プロダクションマシンに依存関係をインストールできなかったか、またはINSTALLED_APPSがproductionとdevの間で異なり、そのライブラリを提供するアプリケーションが見つからないことを意味します。

これはデプロイメントによって発生する可能性は非常に低く、プロダクション環境と開発環境の不連続性によって発生する可能性が非常に高いです。

+0

ちょっと、答えのためのthx。 Apacheとuwsgiで同じパッケージを使用しているので、私はそうは思わないし、アプリケーションは問題なくapacheで動作する。 envsの違いについて - 私のステージはプロダクトと同じですので、私はそうは思わない - それは鏡です。 – Lukasz

+0

@ user1286500プロダクションサーバーのマネージャーシェル内でsso_tokenを手動でインポートできますか?また、すべてのpycファイルを最初に見つけて削除してください。 – okm

+0

はいuwsgiを再起動するとすべてのpycが削除されます – Lukasz

関連する問題