mezzanine
が4.2.2
にversion up
したので、
当ブログのmezzanine
を4.2.0
から4.2.2
にupdate
してみました。
実施した
0. 前提
以下の
OS
CentOS release 6.7 (Final)Python Version
Python 2.7.8Package (必要そうな
ものだけ 抜粋)
Django (1.10)
Mezzanine (4.2.0)
1. UPGRADE
現状Versionの 確認
UPGRADE
前のpip list
[0.]の内容とも 重複しますが、 UPGRADE
前の構成情報に なります。
pip list ------------------------------------ beautifulsoup4 (4.5.1) bleach (1.4.3) chardet (2.3.0) Django (1.10) django-appconf (1.0.2) django-compressor (2.0) django-contrib-comments (1.7.2) django-crontab (0.7.1) django-grappelli (2.8.1) django-htmlmin (0.9.1) django-request (1.4.0) django-robots (2.0) django-sites (0.9) filebrowser-safe (0.4.3) funcsigs (1.0.2) future (0.15.2) grappelli-safe (0.4.2) html5lib (0.9999999) importlib (1.0.3) Markdown (2.6.6) Mezzanine (4.2.0) mezzanine-pagedown (1.0) mezzanine-pubsubhubbub-pub (0.0.3) mock (2.0.0) oauthlib (1.1.2) pbr (1.10.0) Pillow (3.3.0) pip (8.1.2) psycopg2 (2.6.1) Pygments (2.0.2) pytz (2016.6.1) rcssmin (1.0.6) requests (2.11.0) requests-oauthlib (0.6.2) rjsmin (1.0.12) setuptools (25.2.0) six (1.10.0) tzlocal (1.2.2) wheel (0.26.0)
UPGRADE
pip install Mezzanine -U ----------------------------------- Successfully installed Mezzanine-4.2.2 django-1.10.2 django-contrib-comments-1.7.3 filebrowser-safe-0.4.6 grappelli-safe-0.4.5 oauthlib-2.0.0 pillow-3.4.1 pytz-2016.7 requests-2.11.1 requests-oauthlib-0.7.0 -----------------------------------
2. check コマンドに よる 確認
python2.7 manage.py check ----------------------------------- System check identified no issues (0 silenced). -----------------------------------
特に問題なさそうなので、
3. サーバー 起動後の 確認
service httpd restart
サーバー起動後に
Djnago に
Apacheの
mod_wsgi (pid=342): Exception occurred processing WSGI script 'projectname/wsgi.py'. Traceback (most recent call last): File "projectname/wsgi.py", line 22, in application = get_wsgi_application() File "/usr/local/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application return WSGIHandler() File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 153, in __init__ self.load_middleware() File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 58, in load_middleware mw_instance = mw_class() TypeError: __init__() takes exactly 2 arguments (1 given)
エラー発生箇所が、
原因は
Version 4.2.1 で
変更点1
>Add some MIDDLEWARE compatibility fixes that were missing from #1660.
>Also change the way in which the middleware setting is determined.
>A statis variable will fail when settings are modified on the fly, e.g., when running tests - Samir Shah変更点2
>Deprecate SSLRedirectMiddleware. Resolve #1600.
>Also, set default SSL settings to editable=False so they do not. display in the settings by default - ryneeverett
生成しな
差分を
以下、
settings.py
MIDDLEWARE_CLASSES = ( "mezzanine.core.middleware.UpdateCacheMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.middleware.common.CommonMiddleware", # ADD SessionAuthenticationMiddleware 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.messages.middleware.MessageMiddleware", # ADD XFrameOptionsMiddleware 'django.middleware.clickjacking.XFrameOptionsMiddleware', "mezzanine.core.request.CurrentRequestMiddleware", "mezzanine.core.middleware.RedirectFallbackMiddleware", "mezzanine.core.middleware.TemplateForDeviceMiddleware", "mezzanine.core.middleware.TemplateForHostMiddleware", "mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware", "mezzanine.core.middleware.SitePermissionMiddleware", # Uncomment the following if using any of the SSL settings: # DEL "mezzanine.core.middleware.SSLRedirectMiddleware", "mezzanine.pages.middleware.PageMiddleware", "mezzanine.core.middleware.FetchFromCacheMiddleware", )
SessionAuthenticationMiddleware を
追加
これは、あまり 役割も わからずに 追加しています。
djnago 2.0.0 で削除される 予定のようです。 XFrameOptionsMiddleware を
追加
Djangoでクリックジャッキング対策を する ための モジュールです。
デフォルトで、X-Frame-Options SAMEORIGIN を 追加してくれます。 SSLRedirectMiddleware を
削除
Deprecate SSLRedirectMiddleware · Issue #1600 · stephenmcd/mezzanine
に記載されていますが、 Djnago 1.8 から SecurityMiddleware が 追加されたため、
機能が被り、 非推奨と なったようです。 この ため、 settings.py を 生成し直すと 削除されます。
根本原因は
MIDDLEWARE_CLASSES の
以上です。
コメント