2016-05-13 13 views
0

ローカルマシンでDjangoを実行していますが、Djangoサイトをプロダクションサーバーに展開したいところです。私のサーバはApache 2.x、python 2.7、Django 1.8を持つUbuntu 14.04サーバです。私は、Apacheとmod_wsgiをlinkのために、Djangoの基本的な設定を使用してみましたが、私は次のエラーを得続ける:プロダクション用のDjangoデプロイメント

mod_wsgi (pid=14962): Target WSGI script '/var/www/tmws/tmws/wsgi.py' cannot be loaded as Python module., 
mod_wsgi (pid=14962): Exception occurred processing WSGI script '/var/www/tmws/tmws/wsgi.py'., 
Traceback (most recent call last):, 
File "/var/www/tmws/tmws/wsgi.py", line 21, in <module>, 
    application = get_wsgi_application(), 
File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in get_wsgi_application, 
    django.setup(), 
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup, 
    apps.populate(settings.INSTALLED_APPS), 
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate, 
    app_config = AppConfig.create(entry), 
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 86, in create, 
    module = import_module(entry), 
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module, 
    __import__(name), 
File "/var/www/tmws/django_tables2/__init__.py", line 2, in <module>, 
    from .tables import Table, 
File "/var/www/tmws/django_tables2/tables.py", line 15, in <module>, 
    from . import columns, 
File "/var/www/tmws/django_tables2/columns/__init__.py", line 1, in <module>, 
    from .base import library, BoundColumn, BoundColumns, Column, 
File "/var/www/tmws/django_tables2/columns/base.py", line 10, in <module>, 
    from django_tables2.utils import Accessor, AttributeDict, OrderBy, OrderByTuple, 
File "/var/www/tmws/django_tables2/utils.py", line 111, in <module>, 
    @six.python_2_unicode_compatible, 
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible', 

my siteここ

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

はログイン、私は受け付けておりApacheのエラーでエラーですここで

は私のapache2.confファイルです:

... 

<Directory /var/www/tmws/tmws> 
    <Files wsgi.py> 
     Require all granted 
    </Files> 
</Directory> 

... 

WSGIScriptAlias//var/www/tmws/tmws/wsgi.py 
WSGIPythonPath /var/www/tmws 

これは私のwsgi.pyファイルです:

import os, sys 

from django.core.wsgi import get_wsgi_application 

sys.path.append('/home/ubuntu/gather/src') 
sys.path.append('/usr/local/lib/python2.7/dist-packages') 
sys.path.append('/var/www/tmws') 
sys.path.append('/var/www/tmws/tmws') 

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tmws.settings") 

application = get_wsgi_application() 

これは私のウェブサイトでの.confファイル:

<VirtualHost *:80> 
    ServerAdmin xxxxxxxx 
    ServerName xxxxxxxxxxx 
    DocumentRoot /var/www/tmws 
    WSGIScriptAlias//var/www/tmws/tmws/wsgi.py 

    ErrorLog ${APACHE_LOG_DIR}/TMWSerror.log 
    CustomLog ${APACHE_LOG_DIR}/TMWSaccess.log combined 

</VirtualHost> 

任意の助けいただければ幸いです。他に何かがあれば、私に知らせるために投稿することができます。

+0

仮想環境からDjangoを実行していますか?おそらくそうだろう。問題は、古いバージョンの 'six'を使っていることです。 – solarissmoke

+0

ありがとうございます。いいえ、私は仮想環境を使用していません、結局私はしたいです。 6とは何ですか? – user908759

+3

'six'はPythonライブラリです。 'pip install --upgrade six'を使ってアップグレードするとうまくいくはずですが、システムのpythonパッケージでそうするのは理想的ではありません。他のシステムパッケージと競合する危険があるため、仮想環境を使うのが良いでしょう。 – solarissmoke

答えて

1

お使いのシステムでは、python_2_unicode_compatibleメソッドが含まれていない古いバージョンのsix pythonパッケージが使用されている可能性があります。最新バージョンに6をアップグレードすると、それを修正する必要があります言っ

pip install --upgrade six 

が、代わりにシステムレベルでパッケージをインストールする仮想環境からジャンゴを実行することを強くお勧めです - いくつかの理由であることをシステム・パッケージがある場合 sixの古いバージョンに依存している場合は、他の問題が発生する可能性があります。

関連する問題