文件是:
01_packages.config
packages:
yum:
make: []
gcc-c++: []
gcc-gfortran: []
python-devel: []
atlas-sse3-devel: []
lapack-devel: []
libpng-devel: []
freetype-devel: []
zlib-devel: []
container_commands:
AddGlobalWSGIGroupAccess:
command: "if ! grep -q 'WSGIApplicationGroup %{GLOBAL}' ../wsgi.conf ; then echo 'WSGIApplicationGroup %{GLOBAL}' >> ../wsgi.conf; fi;"
02_app.config
option_settings:
"aws:elasticbeanstalk:container:python":
WSGIPath: wsgi.py
NumProcesses: 3
NumThreads: 20
03_python.config
container_commands:
01_pip:
command: "source /opt/python/run/venv/bin/activate && pip install -r requirements.txt"
application.py
from flask import Flask, Response
import json
application = Flask(__name__)
@application.route("/status")
def status():
data = {'status': 'ok'}
js = json.dumps(data)
resp = Response(js, status=200, mimetype='application/json')
return resp
if __name__ == "__main__":
application.run(host='0.0.0.0')
requirements.txt
click==6.7
Flask==0.12
itsdangerous==0.24
Jinja2==2.9.4
MarkupSafe==0.23
Werkzeug==0.11.15
Pandas
wsgi.py
from application import application
**错误:
-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Thu Jan 12 16:02:15.106232 2017] [suexec:notice] [pid 1873] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jan 12 16:02:15.134727 2017] [auth_digest:notice] [pid 1873] AH01757: generating secret for digest authentication ...
[Thu Jan 12 16:02:15.135745 2017] [lbmethod_heartbeat:notice] [pid 1873] AH02282: No slotmem from mod_heartmonitor
[Thu Jan 12 16:02:15.181883 2017] [mpm_prefork:notice] [pid 1873] AH00163: Apache/2.4.23 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Thu Jan 12 16:02:15.181931 2017] [core:notice] [pid 1873] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Jan 12 16:03:52.703980 2017] [mpm_prefork:notice] [pid 1873] AH00169: caught SIGTERM, shutting down
[Thu Jan 12 16:03:53.819021 2017] [suexec:notice] [pid 2170] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jan 12 16:03:53.848192 2017] [so:warn] [pid 2170] AH01574: module wsgi_module is already loaded, skipping
[Thu Jan 12 16:03:53.853287 2017] [auth_digest:notice] [pid 2170] AH01757: generating secret for digest authentication ...
[Thu Jan 12 16:03:53.854699 2017] [lbmethod_heartbeat:notice] [pid 2170] AH02282: No slotmem from mod_heartmonitor
[Thu Jan 12 16:03:53.898034 2017] [mpm_prefork:notice] [pid 2170] AH00163: Apache/2.4.23 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Thu Jan 12 16:03:53.898098 2017] [core:notice] [pid 2170] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Jan 13 23:12:24.441902 2017] [mpm_prefork:notice] [pid 2170] AH00169: caught SIGTERM, shutting down
[Fri Jan 13 23:12:25.564575 2017] [suexec:notice] [pid 17853] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jan 13 23:12:25.594192 2017] [so:warn] [pid 17853] AH01574: module wsgi_module is already loaded, skipping
[Fri Jan 13 23:12:25.599197 2017] [auth_digest:notice] [pid 17853] AH01757: generating secret for digest authentication ...
[Fri Jan 13 23:12:25.600577 2017] [lbmethod_heartbeat:notice] [pid 17853] AH02282: No slotmem from mod_heartmonitor
[Fri Jan 13 23:12:25.638801 2017] [mpm_prefork:notice] [pid 17853] AH00163: Apache/2.4.23 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Fri Jan 13 23:12:25.638853 2017] [core:notice] [pid 17853] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Jan 13 23:12:28.296237 2017] [:error] [pid 17859] [client 127.0.0.1:48206] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py
[Fri Jan 13 23:12:29.299328 2017] [:error] [pid 17860] [client 127.0.0.1:48208] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py
[Fri Jan 13 23:12:30.310453 2017] [:error] [pid 17879] [client 127.0.0.1:48210] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py
[Fri Jan 13 23:12:31.313420 2017] [:error] [pid 17880] [client 127.0.0.1:48212] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py
[Fri Jan 13 23:13:14.723832 2017] [:error] [pid 17883] [client 74.71.99.10:51134] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py
[Fri Jan 13 23:13:14.840052 2017] [:error] [pid 17883] [client 74.71.99.10:51134] Target WSGI script not found or unable to stat: /opt/python/current/app/application.py, referer:
[Fri Jan 13 23:14:53.812319 2017] [mpm_prefork:notice] [pid 17853] AH00169: caught SIGTERM, shutting down
[Fri Jan 13 23:14:54.939628 2017] [suexec:notice] [pid 18168] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jan 13 23:14:54.970873 2017] [so:warn] [pid 18168] AH01574: module wsgi_module is already loaded, skipping
[Fri Jan 13 23:14:54.976070 2017] [auth_digest:notice] [pid 18168] AH01757: generating secret for digest authentication ...
[Fri Jan 13 23:14:54.977525 2017] [lbmethod_heartbeat:notice] [pid 18168] AH02282: No slotmem from mod_heartmonitor
[Fri Jan 13 23:14:55.021898 2017] [mpm_prefork:notice] [pid 18168] AH00163: Apache/2.4.23 (Amazon) mod_wsgi/3.5 Python/3.4.3 configured -- resuming normal operations
[Fri Jan 13 23:14:55.021983 2017] [core:notice] [pid 18168] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'