WebAPIをサーバー上で実行しようとしています。しかし、私は、WebブラウザWSGIアプリケーションをPythonモジュールとして読み込むことはできません。何が間違っているのですか
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log. Apache/2.2.22 (Ubuntu) Server at complex.ffn.ub.es Port 80
を経由して、私は、サイトにログインし、このエラーのたびを取得し続ける私は、エラー・ログ・ファイルをチェックして、私は次のことを持っています。私はこのサイト http://flask.pocoo.org/docs/0.11/deploying/mod_wsgi/
に与えられた指示に基づいて、私の.wsgiファイルを構成し
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] mod_wsgi (pid=21450): Target WSGI script '/home/xarxes_ub/python_code/configure.wsgi' cannot be loaded as Python module.
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] mod_wsgi (pid=21450): Exception occurred processing WSGI script '/home/xarxes_ub/python_code/configure.wsgi'.
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] Traceback (most recent call last):
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] File "/home/xarxes_ub/python_code/configure.wsgi", line 10, in
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] from MenuUB2 import app as application
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] ImportError: No module named MenuUB2
それは、具体的には、「あなたが実際にもvirtualenvのにアプリケーションをインストールする必要がありますので注意してください言及している。またただ、インポートする前に.wsgiファイル内のパスにパッチを適用するためのオプションがあります: import sys sys.path.insert(0, '/path/to/the/application')
「私はここに
がconfigure.wsgiファイル
でやったことはどれさらに、私が編集した私のapache設定ファイルもここにあります。 ###で追加した行を強調しました。
<VirtualHost *:80>
DocumentRoot /var/www/web_del_grup/
################Added lines###############
WSGIScriptAlias /submitFrame /home/xarxes_ub/python_code/configure.wsgi
WSGIDaemonProcess MenuUB2 user=www-data group=www-data threads=5
################Added lines###############
#####################Added Directory####################
<Directory /home/xarxes_ub/python_code>
WSGIScriptReloading On
WSGIProcessGroup MenuUB2
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
#####################Added Directory####################
ErrorLog /var/log/apache2/error.log
# Options -Indexes +FollowSymLinks MultiViews
# RewriteEngine on
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?complex.ffn.ub.edu [NC]
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?complex.ffn.ub.es [NC]
# RewriteRule ^/xarxesub/(.json)$ - [F,NC,L]
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
何をすべきかを教えてください。私がこれを働かせることができれば、私はとても安心できるでしょう。 はまた、私は、静的を返すために、「configure.wsgi」ファイルを変更しようと、それは 例がここ
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
'' WSGIDaemonProcess''には '' WSGIScriptReloading On''や '' user = www-data group = www-data''は必要ないので、 '' python-path =/home/xarxes_ub/python_code''をWSGIスクリプトファイルに '' sys.path''を設定するよりも '' WSGIDaemonProcess''で実行してください。 –
次回はそのことを覚えておきます。すべての助けをありがとう! –