WebAPI를 서버에서 실행하려고했습니다. 그러나 웹 브라우저를 통해 사이트에 로그인 할 때마다이 오류가 계속 발생합니다.내 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
오류 로그 파일을 확인하고 다음을 확인합니다.
는이 사이트 그것은 구체적으로 "당신이 실제로뿐만 아니라 VIRTUALENV에 응용 프로그램을 설치해야합니다 명심 언급한다 http://flask.pocoo.org/docs/0.11/deploying/mod_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
에 주어진 지시에 따라 내 .wsgi 파일을 구성. 또한 내가 여기
가 configure.wsgi 파일 입니다 무슨 짓을했는지 import sys sys.path.insert(0, '/path/to/the/application')
을 "어느 : 바로 가져 오기 전에 .wsgi 파일의 경로를 패치 할 수있는 옵션이있다
여기 내가 편집 한 내 아파치 설정 파일이 있습니다. 나는 ###으로 덧붙인 라인을 강조했다.
<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"파일을 변경 시도 있습니다 그것은 예 좋아, 내가 내 configure.wsgi 파일
I에서 실수를했다 판명 여기
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''로 설정하십시오. –
다음 번에는 그 사실을 명심하겠습니다. 모든 도움에 감사드립니다 !! –