问:
End of script output before headers: wsgi.py deploying python django to AWS EB
I can't get the Django app to deploy to AWS EB. I'm deploying an Django 1.7 app.
The readout from the log files is as follows. I only get an internal server error and have no idea how to fix this. Has anyone run into this before? </p>

```<code>-------------------------------------
/opt/python/log/supervisord.log
-------------------------------------
2016-05-03 15:22:57,677 CRIT Supervisor running as root (no user in config file)
2016-05-03 15:22:57,690 INFO RPC interface 'supervisor' initialized
2016-05-03 15:22:57,690 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2016-05-03 15:22:57,690 INFO supervisord started with pid 2732
2016-05-03 15:22:58,695 INFO spawned: 'httpd' with pid 2813
2016-05-03 15:22:59,961 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-05-03 15:44:46,405 INFO stopped: httpd (exit status 0)
2016-05-03 15:44:47,410 INFO spawned: 'httpd' with pid 3628
2016-05-03 15:44:48,630 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Tue May 03 15:22:58.961698 2016] [suexec:notice] [pid 2813] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue May 03 15:22:58.972366 2016] [auth_digest:notice] [pid 2813] AH01757: generating secret for digest authentication ...
[Tue May 03 15:22:58.972884 2016] [lbmethod_heartbeat:notice] [pid 2813] AH02282: No slotmem from mod_heartmonitor
[Tue May 03 15:22:58.972916 2016] [:warn] [pid 2813] mod_wsgi: Compiled for Python/2.7.9.
[Tue May 03 15:22:58.972919 2016] [:warn] [pid 2813] mod_wsgi: Runtime using Python/2.7.10.
[Tue May 03 15:22:58.974405 2016] [mpm_prefork:notice] [pid 2813] AH00163: Apache/2.4.18 (Amazon) mod_wsgi/3.5 Python/2.7.10 configured -- resuming normal operations
[Tue May 03 15:22:58.974417 2016] [core:notice] [pid 2813] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue May 03 15:44:46.393621 2016] [mpm_prefork:notice] [pid 2813] AH00169: caught SIGTERM, shutting down
[Tue May 03 15:44:47.630036 2016] [suexec:notice] [pid 3628] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue May 03 15:44:47.641260 2016] [so:warn] [pid 3628] AH01574: module wsgi_module is already loaded, skipping
[Tue May 03 15:44:47.643427 2016] [auth_digest:notice] [pid 3628] AH01757: generating secret for digest authentication ...
[Tue May 03 15:44:47.644043 2016] [lbmethod_heartbeat:notice] [pid 3628] AH02282: No slotmem from mod_heartmonitor
[Tue May 03 15:44:47.644087 2016] [:warn] [pid 3628] mod_wsgi: Compiled for Python/2.7.9.
[Tue May 03 15:44:47.644093 2016] [:warn] [pid 3628] mod_wsgi: Runtime using Python/2.7.10.
[Tue May 03 15:44:47.646008 2016] [mpm_prefork:notice] [pid 3628] AH00163: Apache/2.4.18 (Amazon) mod_wsgi/3.5 Python/2.7.10 configured -- resuming normal operations
[Tue May 03 15:44:47.646023 2016] [core:notice] [pid 3628] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue May 03 15:44:55.327286 2016] [core:error] [pid 3634] [client 127.0.0.1:58160] End of script output before headers: wsgi.py
[Tue May 03 15:45:07.985538 2016] [core:error] [pid 3633] [client 127.0.0.1:58162] End of script output before headers: wsgi.py
[Tue May 03 15:45:21.409032 2016] [core:error] [pid 3634] [client 127.0.0.1:58164] End of script output before headers: wsgi.py
[Tue May 03 15:45:35.873643 2016] [core:error] [pid 3632] [client 127.0.0.1:58166] End of script output before headers: wsgi.py
[Tue May 03 15:45:48.389833 2016] [core:error] [pid 3634] [client 127.0.0.1:58168] End of script output before headers: wsgi.py
[Tue May 03 15:46:00.246771 2016] [core:error] [pid 3636] [client 127.0.0.1:58170] End of script output before headers: wsgi.py
[Tue May 03 15:46:13.163713 2016] [core:error] [pid 3632] [client 127.0.0.1:58172] End of script output before headers: wsgi.py
[Tue May 03 15:46:25.899205 2016] [core:error] [pid 3751] [client 127.0.0.1:58174] End of script output before headers: wsgi.py

127.0.0.1 (-) - - [03/May/2016:15:48:56 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:09 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:21 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:33 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:46 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:59 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:13 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:27 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:39 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:52 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:51:05 +0000] "GET / HTTP/1.1" 500 527 "-"

-------------------------------------
/var/log/eb-activity.log
-------------------------------------
  Collecting requests-oauthlib==0.4.1 (from -r /opt/python/ondeck/app/requirements.txt (line 15))
    Downloading requests_oauthlib-0.4.1-py2.py3-none-any.whl
  Collecting static==0.4 (from -r /opt/python/ondeck/app/requirements.txt (line 16))
    Downloading static-0.4.tar.gz
  Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /usr/lib64/python2.7 (from -r /opt/python/ondeck/app/requirements.txt (line 17))
  Collecting yql-finance==0.1.0 (from -r /opt/python/ondeck/app/requirements.txt (line 18))
    Downloading yql-finance-0.1.0.tar.gz
  Collecting django-extensions==1.5.6 (from -r /opt/python/ondeck/app/requirements.txt (line 19))
    Downloading django_extensions-1.5.6-py2.py3-none-any.whl (249kB)
  Collecting facebook (from -r /opt/python/ondeck/app/requirements.txt (line 20))
    Downloading Facebook-0.0.tar.gz
  Collecting nltk (from -r /opt/python/ondeck/app/requirements.txt (line 21))
    Downloading nltk-3.2.1.tar.gz (1.1MB)
  Collecting django-cors-headers (from -r /opt/python/ondeck/app/requirements.txt (line 22))
    Downloading django-cors-headers-1.1.0.tar.gz
  Collecting djangorestframework (from -r /opt/python/ondeck/app/requirements.txt (line 23))
    Downloading djangorestframework-3.3.3-py2.py3-none-any.whl (662kB)
  Collecting slugify (from -r /opt/python/ondeck/app/requirements.txt (line 24))
    Downloading slugify-0.0.1.tar.gz
  Collecting yelp (from -r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading yelp-1.0.2-py2-none-any.whl
  Requirement already satisfied (use --upgrade to upgrade): setuptools in /opt/python/run/venv/lib/python2.7/site-packages (from yql-finance==0.1.0->-r /opt/python/ondeck/app/requirements.txt (line 18))
  Collecting python-dateutil (from yql-finance==0.1.0->-r /opt/python/ondeck/app/requirements.txt (line 18))
    Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
  Collecting six>=1.2 (from django-extensions==1.5.6->-r /opt/python/ondeck/app/requirements.txt (line 19))
    Downloading six-1.10.0-py2.py3-none-any.whl
  Collecting oauth2 (from yelp->-r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading oauth2-1.9.0.post1-py2.py3-none-any.whl
  Collecting httplib2 (from yelp->-r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading httplib2-0.9.2.zip (210kB)
  Installing collected packages: Django, PyYAML, dj-database-url, static, dj-static, python-openid, requests, oauthlib, requests-oauthlib, django-allauth, django-bootstrap-form, psycopg2, gunicorn, django-toolbelt, newrelic, pystache, six, python-dateutil, yql-finance, django-extensions, facebook, nltk, django-cors-headers, djangorestframework, slugify, httplib2, oauth2, yelp
    Running setup.py install for PyYAML
    Running setup.py install for static
    Running setup.py install for dj-static
    Running setup.py install for python-openid
    Running setup.py install for oauthlib
    Running setup.py install for django-allauth
    Running setup.py install for django-bootstrap-form
    Running setup.py install for psycopg2
    Running setup.py install for gunicorn
    Running setup.py install for django-toolbelt
    Running setup.py install for newrelic
    Running setup.py install for pystache
    Running setup.py install for yql-finance
    Running setup.py install for facebook
    Running setup.py install for nltk
    Running setup.py install for django-cors-headers
    Running setup.py install for slugify
    Running setup.py install for httplib2
  Successfully installed Django-1.7.1 PyYAML-3.11 dj-database-url-0.3.0 dj-static-0.0.5 django-allauth-0.17.0 django-bootstrap-form-3.1 django-cors-headers-1.1.0 django-extensions-1.5.6 django-toolbelt-0.0.1 djangorestframework-3.3.3 facebook-0.0 gunicorn-19.0.0 httplib2-0.9.2 newrelic nltk-3.2.1 oauth2-1.9.0.post1 oauthlib-0.6.3 psycopg2-2.5.3 pystache-0.5.4 python-dateutil-2.5.3 python-openid-2.2.5 requests-2.3.0 requests-oauthlib-0.4.1 six-1.10.0 slugify-0.0.1 static-0.4 yelp-1.0.2 yql-finance-0.1.0
  You are using pip version 7.1.2, however version 8.1.1 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
[2016-05-03T15:44:42.926Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook/04configen.py] : Starting activity...
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook/04configen.py] : Completed activity.
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2016-05-03T15:44:45.469Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2016-05-03T15:44:45.469Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2016-05-03T15:44:45.487Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild] : Completed activity.
[2016-05-03T15:44:45.487Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/InfraCleanEbextension] : Starting activity...
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/InfraCleanEbextension] : Completed activity. Result:
  Cleaned ebextensions subdirectories from /opt/python/ondeck/app.
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0] : Completed activity. Result:
  Application update - Command CMD-AppDeploy stage 0 completed
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1] : Starting activity...
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook] : Starting activity...
[2016-05-03T15:44:45.558Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/01flip.py] : Starting activity...
[2016-05-03T15:57:56.923Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/01flip.py] : Completed activity. Result:
  httpd: stopped
  httpd: started
  httpd                            RUNNING   pid 3628, uptime 0:00:03
  2016-05-03 15:57:56,831 WARNING  Apache is running, but root page is not responding in 5mins.
[2016-05-03T15:57:56.977Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Starting activity...
[2016-05-03T15:57:57.937Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Completed activity. Result:
  + chmod 0755 /var/run/httpd
  + /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
  + /opt/elasticbeanstalk/bin/healthd-track-pidfile --name application --location /opt/python/run/supervisord.pid
[2016-05-03T15:57:57.937Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2016-05-03T15:57:57.952Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployPostHook] : Starting activity...
[2016-05-03T15:57:57.953Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployPostHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1] : Completed activity. Result:
  Application version switch - Command CMD-AppDeploy stage 1 completed
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter] : Starting activity...
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation] : Starting activity...
[2016-05-03T15:57:57.966Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
  Disabled forced hourly log rotation.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter] : Completed activity.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2] : Completed activity. Result:
  Application update - Command CMD-AppDeploy succeeded
[2016-05-03T16:01:16.757Z] INFO  [5116]  - [CMD-TailLogs] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/TailLogs] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...

-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Checking if the received command stage is valid..
[2016-05-03T15:36:43.725Z] INFO  [3119]  : No stage_num in command. Valid stage..
[2016-05-03T15:36:43.725Z] INFO  [3119]  : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAIU3PLHMLTUXDRSDA\",\"signature\":\"WjIRC5afYDutyTN5VAjD5xHwmL8=\",\"security_token\":\"FQoDYXdzEEkaDPn2PJGaUqpYePe5uSLYAu4unC5lPBrp4t60gtzZiz3Y42PXZsyMOZ\\\/aVsbZy47XbEKQl89s8tF8Xk+7UrAvVAPT2PRpteadXRA1GtRFA16akUwlz0uH2H03pv8IeiLUtvGa7dEmLwYNYDToa6nCyAiDoX\\\/TgQ5\\\/ez2pttGozivs1LyDDNfqRnAKEN7OHwt7PjcBBeNFrZCGbxr8436XIqn1AuY53dzEVE4id7KaTisthm4lcEYdeMLFIZT5wc4NFXQeVMwd4NWKShsOJhauGKTW0\\\/LpL5HnzVRTbypZR+aUf+KW8PbLjcRdlwBMilorMxxyCGrXYhepruxc33EdHwGeHVLPqUY89JCjIp+KGzlJaJ7gXdgSU3lQm+eizXcPgYF3dbB0oTK72XhcB+RX3nrURZr6ryZkePX4CGQsy8M9q21PEOziGE+mv7EAggoY8xcXXX6X+2hZh3YtsOB38sGo8Jd5okQjKLLNobkF\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNS0wM1QxNjowNjo0MS43NTJaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItNDgwNzAzNDUwNTM4Il0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-3f9799e7"],"data":"d545d29b-1144-11e6-9820-f562aa5e0b83","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"d545d29b-1144-11e6-9820-f562aa5e0b83","command_timeout":"600"}
[2016-05-03T15:36:43.725Z] INFO  [3119]  : Command processor should execute command.
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Storing current stage..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:36:43.726Z] INFO  [3119]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Updating Command definition of addon logpublish.
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Loaded definition of Command CMD-TailLogs.
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing CMD-TailLogs
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing command: CMD-TailLogs...
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing command CMD-TailLogs activities...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Setting environment variables..
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running AddonsBefore for command CMD-TailLogs...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running stage 0 of command CMD-TailLogs...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Loaded 1 actions for stage 0.
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running 1 of 1 actions: TailLogs...
[2016-05-03T15:36:43.907Z] INFO  [3119]  : Running AddonsAfter for command CMD-TailLogs...
[2016-05-03T15:36:43.907Z] INFO  [3119]  : Command CMD-TailLogs succeeded!
[2016-05-03T15:36:43.908Z] INFO  [3119]  : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[{"msg":"[Instance: i-3f9799e7] Successfully finished tailing 5 log(s)","severity":"INFO","timestamp":1462289803907}]}]}
[2016-05-03T15:43:43.621Z] DEBUG [3262]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:43:43.621Z] DEBUG [3262]  : Checking if the command processor should execute...
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Checking whether the command is applicable to instance (i-3f9799e7)..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Command is applicable to this instance (i-3f9799e7)..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Checking if the received command stage is valid..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : No stage_num in command. Valid stage..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Received command CMD-AppDeploy: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-3f9799e7"],"data":"manifest_1462290220556","command_name":"CMD-AppDeploy","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"ca18149a-1145-11e6-917a-13aa1949f4eb","command_timeout":"600"}
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Command processor should execute command.
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Storing current stage..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:43:43.625Z] INFO  [3262]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:43:43.626Z] INFO  [3262]  : Updating Command definition of addon logpublish.
[2016-05-03T15:43:43.626Z] DEBUG [3262]  : Refreshing metadata...
[2016-05-03T15:43:43.875Z] DEBUG [3262]  : Refreshed environment metadata.
[2016-05-03T15:43:43.875Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:43:43.876Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:43:43.876Z] INFO  [3262]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:43:43.877Z] INFO  [3262]  : Updating Command definition of addon logpublish.
[2016-05-03T15:43:43.877Z] DEBUG [3262]  : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
[2016-05-03T15:43:43.877Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2016-05-03T15:43:43.967Z] INFO  [3262]  : Loading manifest from bucket 'elasticbeanstalk-us-west-2-480703450538' using computed S3 key 'resources/environments/e-5rmcvp96pe/_runtime/versions/manifest_1462290220556'.
[2016-05-03T15:43:44.178Z] INFO  [3262]  : Updated manifest cache: deployment ID 2 and serial 2.
[2016-05-03T15:43:44.178Z] DEBUG [3262]  : Loaded definition of Command CMD-AppDeploy.
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing Application update
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing command: CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing command CMD-AppDeploy activities...
[2016-05-03T15:43:44.179Z] DEBUG [3262]  : Setting environment variables..
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running AddonsBefore for command CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] DEBUG [3262]  : Running stages of Command CMD-AppDeploy from stage 0 to stage 1...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running stage 0 of command CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running leader election...
[2016-05-03T15:43:44.427Z] INFO  [3262]  : Instance is Leader.
[2016-05-03T15:43:44.427Z] DEBUG [3262]  : Loaded 6 actions for stage 0.
[2016-05-03T15:43:44.427Z] INFO  [3262]  : Running 1 of 6 actions: InfraWriteConfig...
[2016-05-03T15:43:44.430Z] INFO  [3262]  : Running 2 of 6 actions: DownloadSourceBundle...
[2016-05-03T15:43:50.220Z] INFO  [3262]  : Running 3 of 6 actions: EbExtensionPreBuild...
[2016-05-03T15:43:53.769Z] INFO  [3262]  : Running 4 of 6 actions: AppDeployPreHook...
[2016-05-03T15:44:44.996Z] INFO  [3262]  : Running 5 of 6 actions: EbExtensionPostBuild...
[2016-05-03T15:44:45.487Z] INFO  [3262]  : Running 6 of 6 actions: InfraCleanEbextension...
[2016-05-03T15:44:45.537Z] INFO  [3262]  : Running stage 1 of command CMD-AppDeploy...
[2016-05-03T15:44:45.537Z] DEBUG [3262]  : Loaded 2 actions for stage 1.
[2016-05-03T15:44:45.537Z] INFO  [3262]  : Running 1 of 2 actions: AppDeployEnactHook...
[2016-05-03T15:57:57.937Z] INFO  [3262]  : Running 2 of 2 actions: AppDeployPostHook...
[2016-05-03T15:57:57.954Z] INFO  [3262]  : Running AddonsAfter for command CMD-AppDeploy...
[2016-05-03T15:57:58.789Z] INFO  [3262]  : Command CMD-AppDeploy succeeded!
[2016-05-03T15:57:58.789Z] INFO  [3262]  : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2016-05-03T16:01:16.717Z] DEBUG [5116]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T16:01:16.718Z] DEBUG [5116]  : Checking if the command processor should execute...
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Checking whether the command is applicable to instance (i-3f9799e7)..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Command is applicable to this instance (i-3f9799e7)..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Checking if the received command stage is valid..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : No stage_num in command. Valid stage..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAIWLAGZVTPWB52MJA\",\"signature\":\"t5Z6+mbCqyJ8q5MWLyxy3ej0UNY=\",\"security_token\":\"FQoDYXdzEEkaDG0VYuGveqsxWN9CbCLYAq2jeX\\\/cCrZT8XMZrc9Sqx0tXesuSy\\\/bDpClDZ+Ewpg0HQebca1pnu3uET6n3GQVxfecs\\\/MaJwhKap++G76Vn+UF590l95n3lSKDnHaEgz7N8Tb9DhUguHguYG9+GrsrwIY6MC94m2SDPcKhmK2\\\/GXOYfIOSfOO3mfOFNOq9dEFpo5JmpE+B2WSkPqs80wA2\\\/XttTEyfZzmfBRNBfJR+xUb11hhVKbr45xw11S4bb4iLbWOGqTQkLC3lkMPE0r7sawXwneO0zVnnUfZ7Zk8A+VnNiTIfRy686Ikc3eTJpKdTwJX+sxf73o6V+zoiAWnvTQ4STRnVoo33SuK1i39u508M0tiNGZMRGXT9Vx0Px5SXnQM77lPgahMFsTCL4TL5zNpcUACnbqKyOsBeDHP+X4PS7yDS\\\/3RbzB\\\/qNkRcACcyPY46xGZl3b9jfeToXRyu839znFZ7ANnqKLLNobkF\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNS0wM1QxNjozMToxNC4yODNaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItNDgwNzAzNDUwNTM4Il0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-3f9799e7"],"data":"42f811e1-1148-11e6-9820-f562aa5e0b83","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"42f811e1-1148-11e6-9820-f562aa5e0b83","command_timeout":"600"}
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Command processor should execute command.
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Storing current stage..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T16:01:16.723Z] DEBUG [5116]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T16:01:16.723Z] INFO  [5116]  : Found enabled addons: ["logpublish"].
[2016-05-03T16:01:16.756Z] INFO  [5116]  : Updating Command definition of addon logpublish.
[2016-05-03T16:01:16.757Z] DEBUG [5116]  : Loaded definition of Command CMD-TailLogs.
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing CMD-TailLogs
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing command: CMD-TailLogs...
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing command CMD-TailLogs activities...
[2016-05-03T16:01:16.757Z] DEBUG [5116]  : Setting environment variables..
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running AddonsBefore for command CMD-TailLogs...
[2016-05-03T16:01:16.758Z] DEBUG [5116]  : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running stage 0 of command CMD-TailLogs...
[2016-05-03T16:01:16.758Z] DEBUG [5116]  : Loaded 1 actions for stage 0.
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running 1 of 1 actions: TailLogs...
</code>```

答:
When I encountered this error, this helped me find my way.

To sum it all up, add the WSGIApplicationGroup %{GLOBAL} directive after the WSGIProcessGroup line.

To get a more detailed explanation go here.

Body:
I can't get the Django app to deploy to AWS EB. I'm deploying an Django 1.7 app.
The readout from the log files is as follows. I only get an internal server error and have no idea how to fix this. Has anyone run into this before?

-------------------------------------
/opt/python/log/supervisord.log
-------------------------------------
2016-05-03 15:22:57,677 CRIT Supervisor running as root (no user in config file)
2016-05-03 15:22:57,690 INFO RPC interface 'supervisor' initialized
2016-05-03 15:22:57,690 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2016-05-03 15:22:57,690 INFO supervisord started with pid 2732
2016-05-03 15:22:58,695 INFO spawned: 'httpd' with pid 2813
2016-05-03 15:22:59,961 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-05-03 15:44:46,405 INFO stopped: httpd (exit status 0)
2016-05-03 15:44:47,410 INFO spawned: 'httpd' with pid 3628
2016-05-03 15:44:48,630 INFO success: httpd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Tue May 03 15:22:58.961698 2016] [suexec:notice] [pid 2813] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue May 03 15:22:58.972366 2016] [auth_digest:notice] [pid 2813] AH01757: generating secret for digest authentication ...
[Tue May 03 15:22:58.972884 2016] [lbmethod_heartbeat:notice] [pid 2813] AH02282: No slotmem from mod_heartmonitor
[Tue May 03 15:22:58.972916 2016] [:warn] [pid 2813] mod_wsgi: Compiled for Python/2.7.9.
[Tue May 03 15:22:58.972919 2016] [:warn] [pid 2813] mod_wsgi: Runtime using Python/2.7.10.
[Tue May 03 15:22:58.974405 2016] [mpm_prefork:notice] [pid 2813] AH00163: Apache/2.4.18 (Amazon) mod_wsgi/3.5 Python/2.7.10 configured -- resuming normal operations
[Tue May 03 15:22:58.974417 2016] [core:notice] [pid 2813] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue May 03 15:44:46.393621 2016] [mpm_prefork:notice] [pid 2813] AH00169: caught SIGTERM, shutting down
[Tue May 03 15:44:47.630036 2016] [suexec:notice] [pid 3628] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue May 03 15:44:47.641260 2016] [so:warn] [pid 3628] AH01574: module wsgi_module is already loaded, skipping
[Tue May 03 15:44:47.643427 2016] [auth_digest:notice] [pid 3628] AH01757: generating secret for digest authentication ...
[Tue May 03 15:44:47.644043 2016] [lbmethod_heartbeat:notice] [pid 3628] AH02282: No slotmem from mod_heartmonitor
[Tue May 03 15:44:47.644087 2016] [:warn] [pid 3628] mod_wsgi: Compiled for Python/2.7.9.
[Tue May 03 15:44:47.644093 2016] [:warn] [pid 3628] mod_wsgi: Runtime using Python/2.7.10.
[Tue May 03 15:44:47.646008 2016] [mpm_prefork:notice] [pid 3628] AH00163: Apache/2.4.18 (Amazon) mod_wsgi/3.5 Python/2.7.10 configured -- resuming normal operations
[Tue May 03 15:44:47.646023 2016] [core:notice] [pid 3628] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue May 03 15:44:55.327286 2016] [core:error] [pid 3634] [client 127.0.0.1:58160] End of script output before headers: wsgi.py
[Tue May 03 15:45:07.985538 2016] [core:error] [pid 3633] [client 127.0.0.1:58162] End of script output before headers: wsgi.py
[Tue May 03 15:45:21.409032 2016] [core:error] [pid 3634] [client 127.0.0.1:58164] End of script output before headers: wsgi.py
[Tue May 03 15:45:35.873643 2016] [core:error] [pid 3632] [client 127.0.0.1:58166] End of script output before headers: wsgi.py
[Tue May 03 15:45:48.389833 2016] [core:error] [pid 3634] [client 127.0.0.1:58168] End of script output before headers: wsgi.py
[Tue May 03 15:46:00.246771 2016] [core:error] [pid 3636] [client 127.0.0.1:58170] End of script output before headers: wsgi.py
[Tue May 03 15:46:13.163713 2016] [core:error] [pid 3632] [client 127.0.0.1:58172] End of script output before headers: wsgi.py
[Tue May 03 15:46:25.899205 2016] [core:error] [pid 3751] [client 127.0.0.1:58174] End of script output before headers: wsgi.py

127.0.0.1 (-) - - [03/May/2016:15:48:56 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:09 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:21 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:33 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:46 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:49:59 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:13 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:27 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:39 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:50:52 +0000] "GET / HTTP/1.1" 500 527 "-" "Python-urllib/2.7"
127.0.0.1 (-) - - [03/May/2016:15:51:05 +0000] "GET / HTTP/1.1" 500 527 "-"

-------------------------------------
/var/log/eb-activity.log
-------------------------------------
  Collecting requests-oauthlib==0.4.1 (from -r /opt/python/ondeck/app/requirements.txt (line 15))
    Downloading requests_oauthlib-0.4.1-py2.py3-none-any.whl
  Collecting static==0.4 (from -r /opt/python/ondeck/app/requirements.txt (line 16))
    Downloading static-0.4.tar.gz
  Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /usr/lib64/python2.7 (from -r /opt/python/ondeck/app/requirements.txt (line 17))
  Collecting yql-finance==0.1.0 (from -r /opt/python/ondeck/app/requirements.txt (line 18))
    Downloading yql-finance-0.1.0.tar.gz
  Collecting django-extensions==1.5.6 (from -r /opt/python/ondeck/app/requirements.txt (line 19))
    Downloading django_extensions-1.5.6-py2.py3-none-any.whl (249kB)
  Collecting facebook (from -r /opt/python/ondeck/app/requirements.txt (line 20))
    Downloading Facebook-0.0.tar.gz
  Collecting nltk (from -r /opt/python/ondeck/app/requirements.txt (line 21))
    Downloading nltk-3.2.1.tar.gz (1.1MB)
  Collecting django-cors-headers (from -r /opt/python/ondeck/app/requirements.txt (line 22))
    Downloading django-cors-headers-1.1.0.tar.gz
  Collecting djangorestframework (from -r /opt/python/ondeck/app/requirements.txt (line 23))
    Downloading djangorestframework-3.3.3-py2.py3-none-any.whl (662kB)
  Collecting slugify (from -r /opt/python/ondeck/app/requirements.txt (line 24))
    Downloading slugify-0.0.1.tar.gz
  Collecting yelp (from -r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading yelp-1.0.2-py2-none-any.whl
  Requirement already satisfied (use --upgrade to upgrade): setuptools in /opt/python/run/venv/lib/python2.7/site-packages (from yql-finance==0.1.0->-r /opt/python/ondeck/app/requirements.txt (line 18))
  Collecting python-dateutil (from yql-finance==0.1.0->-r /opt/python/ondeck/app/requirements.txt (line 18))
    Downloading python_dateutil-2.5.3-py2.py3-none-any.whl (201kB)
  Collecting six>=1.2 (from django-extensions==1.5.6->-r /opt/python/ondeck/app/requirements.txt (line 19))
    Downloading six-1.10.0-py2.py3-none-any.whl
  Collecting oauth2 (from yelp->-r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading oauth2-1.9.0.post1-py2.py3-none-any.whl
  Collecting httplib2 (from yelp->-r /opt/python/ondeck/app/requirements.txt (line 25))
    Downloading httplib2-0.9.2.zip (210kB)
  Installing collected packages: Django, PyYAML, dj-database-url, static, dj-static, python-openid, requests, oauthlib, requests-oauthlib, django-allauth, django-bootstrap-form, psycopg2, gunicorn, django-toolbelt, newrelic, pystache, six, python-dateutil, yql-finance, django-extensions, facebook, nltk, django-cors-headers, djangorestframework, slugify, httplib2, oauth2, yelp
    Running setup.py install for PyYAML
    Running setup.py install for static
    Running setup.py install for dj-static
    Running setup.py install for python-openid
    Running setup.py install for oauthlib
    Running setup.py install for django-allauth
    Running setup.py install for django-bootstrap-form
    Running setup.py install for psycopg2
    Running setup.py install for gunicorn
    Running setup.py install for django-toolbelt
    Running setup.py install for newrelic
    Running setup.py install for pystache
    Running setup.py install for yql-finance
    Running setup.py install for facebook
    Running setup.py install for nltk
    Running setup.py install for django-cors-headers
    Running setup.py install for slugify
    Running setup.py install for httplib2
  Successfully installed Django-1.7.1 PyYAML-3.11 dj-database-url-0.3.0 dj-static-0.0.5 django-allauth-0.17.0 django-bootstrap-form-3.1 django-cors-headers-1.1.0 django-extensions-1.5.6 django-toolbelt-0.0.1 djangorestframework-3.3.3 facebook-0.0 gunicorn-19.0.0 httplib2-0.9.2 newrelic nltk-3.2.1 oauth2-1.9.0.post1 oauthlib-0.6.3 psycopg2-2.5.3 pystache-0.5.4 python-dateutil-2.5.3 python-openid-2.2.5 requests-2.3.0 requests-oauthlib-0.4.1 six-1.10.0 slugify-0.0.1 static-0.4 yelp-1.0.2 yql-finance-0.1.0
  You are using pip version 7.1.2, however version 8.1.1 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
[2016-05-03T15:44:42.926Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook/04configen.py] : Starting activity...
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook/04configen.py] : Completed activity.
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2016-05-03T15:44:44.996Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2016-05-03T15:44:45.469Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2016-05-03T15:44:45.469Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Completed activity.
[2016-05-03T15:44:45.487Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/EbExtensionPostBuild] : Completed activity.
[2016-05-03T15:44:45.487Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/InfraCleanEbextension] : Starting activity...
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0/InfraCleanEbextension] : Completed activity. Result:
  Cleaned ebextensions subdirectories from /opt/python/ondeck/app.
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage0] : Completed activity. Result:
  Application update - Command CMD-AppDeploy stage 0 completed
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1] : Starting activity...
[2016-05-03T15:44:45.537Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook] : Starting activity...
[2016-05-03T15:44:45.558Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/01flip.py] : Starting activity...
[2016-05-03T15:57:56.923Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/01flip.py] : Completed activity. Result:
  httpd: stopped
  httpd: started
  httpd                            RUNNING   pid 3628, uptime 0:00:03
  2016-05-03 15:57:56,831 WARNING  Apache is running, but root page is not responding in 5mins.
[2016-05-03T15:57:56.977Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Starting activity...
[2016-05-03T15:57:57.937Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook/02create_pids_for_monitoring.sh] : Completed activity. Result:
  + chmod 0755 /var/run/httpd
  + /opt/elasticbeanstalk/bin/healthd-track-pidfile --proxy httpd
  + /opt/elasticbeanstalk/bin/healthd-track-pidfile --name application --location /opt/python/run/supervisord.pid
[2016-05-03T15:57:57.937Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployEnactHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/enact.
[2016-05-03T15:57:57.952Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployPostHook] : Starting activity...
[2016-05-03T15:57:57.953Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1/AppDeployPostHook] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/post.
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AppDeployStage1] : Completed activity. Result:
  Application version switch - Command CMD-AppDeploy stage 1 completed
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter] : Starting activity...
[2016-05-03T15:57:57.954Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation] : Starting activity...
[2016-05-03T15:57:57.966Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
  Disabled forced hourly log rotation.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
  Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2/AddonsAfter] : Completed activity.
[2016-05-03T15:57:58.789Z] INFO  [3262]  - [Application update app-64dd-160503_163926@2] : Completed activity. Result:
  Application update - Command CMD-AppDeploy succeeded
[2016-05-03T16:01:16.757Z] INFO  [5116]  - [CMD-TailLogs] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/TailLogs] : Starting activity...
[2016-05-03T16:01:16.758Z] INFO  [5116]  - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...

-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Checking if the received command stage is valid..
[2016-05-03T15:36:43.725Z] INFO  [3119]  : No stage_num in command. Valid stage..
[2016-05-03T15:36:43.725Z] INFO  [3119]  : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAIU3PLHMLTUXDRSDA\",\"signature\":\"WjIRC5afYDutyTN5VAjD5xHwmL8=\",\"security_token\":\"FQoDYXdzEEkaDPn2PJGaUqpYePe5uSLYAu4unC5lPBrp4t60gtzZiz3Y42PXZsyMOZ\\\/aVsbZy47XbEKQl89s8tF8Xk+7UrAvVAPT2PRpteadXRA1GtRFA16akUwlz0uH2H03pv8IeiLUtvGa7dEmLwYNYDToa6nCyAiDoX\\\/TgQ5\\\/ez2pttGozivs1LyDDNfqRnAKEN7OHwt7PjcBBeNFrZCGbxr8436XIqn1AuY53dzEVE4id7KaTisthm4lcEYdeMLFIZT5wc4NFXQeVMwd4NWKShsOJhauGKTW0\\\/LpL5HnzVRTbypZR+aUf+KW8PbLjcRdlwBMilorMxxyCGrXYhepruxc33EdHwGeHVLPqUY89JCjIp+KGzlJaJ7gXdgSU3lQm+eizXcPgYF3dbB0oTK72XhcB+RX3nrURZr6ryZkePX4CGQsy8M9q21PEOziGE+mv7EAggoY8xcXXX6X+2hZh3YtsOB38sGo8Jd5okQjKLLNobkF\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNS0wM1QxNjowNjo0MS43NTJaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItNDgwNzAzNDUwNTM4Il0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-3f9799e7"],"data":"d545d29b-1144-11e6-9820-f562aa5e0b83","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"d545d29b-1144-11e6-9820-f562aa5e0b83","command_timeout":"600"}
[2016-05-03T15:36:43.725Z] INFO  [3119]  : Command processor should execute command.
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Storing current stage..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:36:43.725Z] DEBUG [3119]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:36:43.726Z] INFO  [3119]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Updating Command definition of addon logpublish.
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Loaded definition of Command CMD-TailLogs.
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing CMD-TailLogs
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing command: CMD-TailLogs...
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Executing command CMD-TailLogs activities...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Setting environment variables..
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running AddonsBefore for command CMD-TailLogs...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running stage 0 of command CMD-TailLogs...
[2016-05-03T15:36:43.727Z] DEBUG [3119]  : Loaded 1 actions for stage 0.
[2016-05-03T15:36:43.727Z] INFO  [3119]  : Running 1 of 1 actions: TailLogs...
[2016-05-03T15:36:43.907Z] INFO  [3119]  : Running AddonsAfter for command CMD-TailLogs...
[2016-05-03T15:36:43.907Z] INFO  [3119]  : Command CMD-TailLogs succeeded!
[2016-05-03T15:36:43.908Z] INFO  [3119]  : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[{"msg":"[Instance: i-3f9799e7] Successfully finished tailing 5 log(s)","severity":"INFO","timestamp":1462289803907}]}]}
[2016-05-03T15:43:43.621Z] DEBUG [3262]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:43:43.621Z] DEBUG [3262]  : Checking if the command processor should execute...
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Checking whether the command is applicable to instance (i-3f9799e7)..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Command is applicable to this instance (i-3f9799e7)..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Checking if the received command stage is valid..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : No stage_num in command. Valid stage..
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Received command CMD-AppDeploy: {"execution_data":"{\"leader_election\":\"true\"}","instance_ids":["i-3f9799e7"],"data":"manifest_1462290220556","command_name":"CMD-AppDeploy","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"ca18149a-1145-11e6-917a-13aa1949f4eb","command_timeout":"600"}
[2016-05-03T15:43:43.624Z] INFO  [3262]  : Command processor should execute command.
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Storing current stage..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:43:43.624Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:43:43.625Z] INFO  [3262]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:43:43.626Z] INFO  [3262]  : Updating Command definition of addon logpublish.
[2016-05-03T15:43:43.626Z] DEBUG [3262]  : Refreshing metadata...
[2016-05-03T15:43:43.875Z] DEBUG [3262]  : Refreshed environment metadata.
[2016-05-03T15:43:43.875Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T15:43:43.876Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T15:43:43.876Z] INFO  [3262]  : Found enabled addons: ["logpublish"].
[2016-05-03T15:43:43.877Z] INFO  [3262]  : Updating Command definition of addon logpublish.
[2016-05-03T15:43:43.877Z] DEBUG [3262]  : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
[2016-05-03T15:43:43.877Z] DEBUG [3262]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2016-05-03T15:43:43.967Z] INFO  [3262]  : Loading manifest from bucket 'elasticbeanstalk-us-west-2-480703450538' using computed S3 key 'resources/environments/e-5rmcvp96pe/_runtime/versions/manifest_1462290220556'.
[2016-05-03T15:43:44.178Z] INFO  [3262]  : Updated manifest cache: deployment ID 2 and serial 2.
[2016-05-03T15:43:44.178Z] DEBUG [3262]  : Loaded definition of Command CMD-AppDeploy.
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing Application update
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing command: CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Executing command CMD-AppDeploy activities...
[2016-05-03T15:43:44.179Z] DEBUG [3262]  : Setting environment variables..
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running AddonsBefore for command CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] DEBUG [3262]  : Running stages of Command CMD-AppDeploy from stage 0 to stage 1...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running stage 0 of command CMD-AppDeploy...
[2016-05-03T15:43:44.179Z] INFO  [3262]  : Running leader election...
[2016-05-03T15:43:44.427Z] INFO  [3262]  : Instance is Leader.
[2016-05-03T15:43:44.427Z] DEBUG [3262]  : Loaded 6 actions for stage 0.
[2016-05-03T15:43:44.427Z] INFO  [3262]  : Running 1 of 6 actions: InfraWriteConfig...
[2016-05-03T15:43:44.430Z] INFO  [3262]  : Running 2 of 6 actions: DownloadSourceBundle...
[2016-05-03T15:43:50.220Z] INFO  [3262]  : Running 3 of 6 actions: EbExtensionPreBuild...
[2016-05-03T15:43:53.769Z] INFO  [3262]  : Running 4 of 6 actions: AppDeployPreHook...
[2016-05-03T15:44:44.996Z] INFO  [3262]  : Running 5 of 6 actions: EbExtensionPostBuild...
[2016-05-03T15:44:45.487Z] INFO  [3262]  : Running 6 of 6 actions: InfraCleanEbextension...
[2016-05-03T15:44:45.537Z] INFO  [3262]  : Running stage 1 of command CMD-AppDeploy...
[2016-05-03T15:44:45.537Z] DEBUG [3262]  : Loaded 2 actions for stage 1.
[2016-05-03T15:44:45.537Z] INFO  [3262]  : Running 1 of 2 actions: AppDeployEnactHook...
[2016-05-03T15:57:57.937Z] INFO  [3262]  : Running 2 of 2 actions: AppDeployPostHook...
[2016-05-03T15:57:57.954Z] INFO  [3262]  : Running AddonsAfter for command CMD-AppDeploy...
[2016-05-03T15:57:58.789Z] INFO  [3262]  : Command CMD-AppDeploy succeeded!
[2016-05-03T15:57:58.789Z] INFO  [3262]  : Command processor returning results:
{"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"","returncode":0,"events":[]}]}
[2016-05-03T16:01:16.717Z] DEBUG [5116]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T16:01:16.718Z] DEBUG [5116]  : Checking if the command processor should execute...
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Checking whether the command is applicable to instance (i-3f9799e7)..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Command is applicable to this instance (i-3f9799e7)..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Checking if the received command stage is valid..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : No stage_num in command. Valid stage..
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Received command CMD-TailLogs: {"execution_data":"{\"aws_access_key_id\":\"ASIAIWLAGZVTPWB52MJA\",\"signature\":\"t5Z6+mbCqyJ8q5MWLyxy3ej0UNY=\",\"security_token\":\"FQoDYXdzEEkaDG0VYuGveqsxWN9CbCLYAq2jeX\\\/cCrZT8XMZrc9Sqx0tXesuSy\\\/bDpClDZ+Ewpg0HQebca1pnu3uET6n3GQVxfecs\\\/MaJwhKap++G76Vn+UF590l95n3lSKDnHaEgz7N8Tb9DhUguHguYG9+GrsrwIY6MC94m2SDPcKhmK2\\\/GXOYfIOSfOO3mfOFNOq9dEFpo5JmpE+B2WSkPqs80wA2\\\/XttTEyfZzmfBRNBfJR+xUb11hhVKbr45xw11S4bb4iLbWOGqTQkLC3lkMPE0r7sawXwneO0zVnnUfZ7Zk8A+VnNiTIfRy686Ikc3eTJpKdTwJX+sxf73o6V+zoiAWnvTQ4STRnVoo33SuK1i39u508M0tiNGZMRGXT9Vx0Px5SXnQM77lPgahMFsTCL4TL5zNpcUACnbqKyOsBeDHP+X4PS7yDS\\\/3RbzB\\\/qNkRcACcyPY46xGZl3b9jfeToXRyu839znFZ7ANnqKLLNobkF\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNi0wNS0wM1QxNjozMToxNC4yODNaIiwiY29uZGl0aW9ucyI6W1sic3RhcnRzLXdpdGgiLCIkeC1hbXotbWV0YS10aW1lX3N0YW1wIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLXB1Ymxpc2hfbWVjaGFuaXNtIiwiIl0sWyJzdGFydHMtd2l0aCIsIiRrZXkiLCJyZXNvdXJjZXNcL2Vudmlyb25tZW50c1wvbG9nc1wvIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWJhdGNoX2lkIiwiIl0sWyJzdGFydHMtd2l0aCIsIiR4LWFtei1tZXRhLWZpbGVfbmFtZSIsIiJdLFsic3RhcnRzLXdpdGgiLCIkeC1hbXotc2VjdXJpdHktdG9rZW4iLCIiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsIiJdLFsiZXEiLCIkYnVja2V0IiwiZWxhc3RpY2JlYW5zdGFsay11cy13ZXN0LTItNDgwNzAzNDUwNTM4Il0sWyJlcSIsIiRhY2wiLCJwcml2YXRlIl1dfQ==\"}","instance_ids":["i-3f9799e7"],"data":"42f811e1-1148-11e6-9820-f562aa5e0b83","command_name":"CMD-TailLogs","api_version":"1.0","resource_name":"AWSEBAutoScalingGroup","request_id":"42f811e1-1148-11e6-9820-f562aa5e0b83","command_timeout":"600"}
[2016-05-03T16:01:16.721Z] INFO  [5116]  : Command processor should execute command.
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Storing current stage..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Stage_num does not exist. Not saving null stage. Returning..
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Reading config file: /etc/elasticbeanstalk/.aws-eb-stack.properties
[2016-05-03T16:01:16.721Z] DEBUG [5116]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_ContainerConfigFileContent||commands..
[2016-05-03T16:01:16.723Z] DEBUG [5116]  : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2016-05-03T16:01:16.723Z] INFO  [5116]  : Found enabled addons: ["logpublish"].
[2016-05-03T16:01:16.756Z] INFO  [5116]  : Updating Command definition of addon logpublish.
[2016-05-03T16:01:16.757Z] DEBUG [5116]  : Loaded definition of Command CMD-TailLogs.
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing CMD-TailLogs
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing command: CMD-TailLogs...
[2016-05-03T16:01:16.757Z] INFO  [5116]  : Executing command CMD-TailLogs activities...
[2016-05-03T16:01:16.757Z] DEBUG [5116]  : Setting environment variables..
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running AddonsBefore for command CMD-TailLogs...
[2016-05-03T16:01:16.758Z] DEBUG [5116]  : Running stages of Command CMD-TailLogs from stage 0 to stage 0...
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running stage 0 of command CMD-TailLogs...
[2016-05-03T16:01:16.758Z] DEBUG [5116]  : Loaded 1 actions for stage 0.
[2016-05-03T16:01:16.758Z] INFO  [5116]  : Running 1 of 1 actions: TailLogs...


来源: stackexchange

问:
What is the simplest way of chaining together animations using promises?
I'm trying to chain together a few animations created with the requestAnimationFrame method (no jQuery used). Because of the way requestAnimationFrame is implemented, timing the successive animations with setTimeout doesn't produce the desired result. Hence, I'm attempting to accomplish my objective using promises.

As a JavaScript tyro, I'm still struggling a bit with this whole promise concept. Could someone please tell me why the (admittedly naive) approach taken below doesn't work? Many thanks in advance!

```<code>var animation1 = function(){
    var promise = Promise.resolve();
    var t = 0;
    var runAnimation = function(){
        if (t < endValue) {
            t++;
            // do animation stuff
            requestAnimationFrame(runAnimation)
        }
        else{return promise}
    }
    runAnimation();
}

var animation2 = function(){
    var promise = Promise.resolve();
    var t = 0;
    var runAnimation = function(){
        if (t < endValue) {
            t++;
            // do animation stuff
            requestAnimationFrame(runAnimation)
        }
        else{return promise}
    }
    runAnimation();
}

animation1().then(animation2());
</code>```

答:
You need to return a Promise from the function

```<code>var animation1 = function(){
    return new Promise(function(resolve) {
      var t = 0;
      var runAnimation = function(){
          if (t < endValue) {
              t++;
              // do animation stuff
              requestAnimationFrame(runAnimation)
          }
          else{resolve()}
      };

      runAnimation();
   });
}
</code>```

Same for animation2

And chaining should look like this

```<code>animation1().then(animation2) //<-- pass function not the result of its invocation
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I'm trying to chain together a few animations created with the requestAnimationFrame method (no jQuery used). Because of the way requestAnimationFrame is implemented, timing the successive animations with setTimeout doesn't produce the desired result. Hence, I'm attempting to accomplish my objective using promises.

As a JavaScript tyro, I'm still struggling a bit with this whole promise concept. Could someone please tell me why the (admittedly naive) approach taken below doesn't work? Many thanks in advance!

var animation1 = function(){
    var promise = Promise.resolve();
    var t = 0;
    var runAnimation = function(){
        if (t < endValue) {
            t++;
            // do animation stuff
            requestAnimationFrame(runAnimation)
        }
        else{return promise}
    }
    runAnimation();
}

var animation2 = function(){
    var promise = Promise.resolve();
    var t = 0;
    var runAnimation = function(){
        if (t < endValue) {
            t++;
            // do animation stuff
            requestAnimationFrame(runAnimation)
        }
        else{return promise}
    }
    runAnimation();
}

animation1().then(animation2());

Body:
You need to return a Promise from the function

var animation1 = function(){
    return new Promise(function(resolve) {
      var t = 0;
      var runAnimation = function(){
          if (t < endValue) {
              t++;
              // do animation stuff
              requestAnimationFrame(runAnimation)
          }
          else{resolve()}
      };

      runAnimation();
   });
}

Same for animation2

And chaining should look like this

animation1().then(animation2) //<-- pass function not the result of its invocation


问:
Different result between localCompare and comparison operator for special characters in JavaScript
While looking at one issue related to sorting, I came across interesting difference for non alpha numeric characters comparison between string localeCompare method and conditional operator (like >,<).

You can see difference between them by running below snippets in different browsers.

function comparison1(param1, param2){
  return param1 > param2;
}

function comparison2(param1, param2){
  return param1.localeCompare(param2);
}
document.getElementById("comparison11").innerHTML = comparison1('A', 'B');
document.getElementById("comparison12").innerHTML = comparison2('A', 'B');
document.getElementById("comparison21").innerHTML = comparison1('@', '_');
document.getElementById("comparison22").innerHTML = comparison2('@', '_');```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div>
  <div style="float: left, width: 100%">
    'A' > 'B'
  </div>
  <div style="float: left, width: 100%" id="comparison11"></div>
  <div style="float: left, width: 100%">
    'A'.localeCompare('B')
  </div>
  <div style="float: left, width: 100%" id="comparison12"></div>
  <div style="float: left, width: 100%">
    '@' > '_'
  </div>
  <div style="float: left, width: 100%" id="comparison21"></div>
  <div style="float: left, width: 100%">
    '@'.localeCompare('_')<br/>
    <i>returns -1 in IE and Edge but 1 in Chrome and Firefox</i>
  </div>
  <div style="float: left, width: 100%" id="comparison22"></div>

</div>
<script>
</script></code>```

As you can see there is difference in response while comparing '@' and '_' when using localeCompare method and > operator in Chrome and Firefox.

We implemented comparison method for sorting that is called for multiple columns with different data types. So we used conditional operators, but as you can see it is providing different result for non alpha numeric characters in different browsers.

Here are my questions!

Why different response for special characters in different browsers?

What is correct way to implement this? (Check data type; if string use localeCompare else conditional operator?)

答:
Why different response for special characters in different browsers?

Probably because as it says in the ECMA-402 (internationalization) spec:

Subsets of Unicode: Some operations, such as collation, operate on strings that can include characters from the entire Unicode character set. However, both the Unicode standard and the ECMAScript standard allow implementations to limit their functionality to subsets of the Unicode character set. In addition, locale conventions typically don’t specify the desired behaviour for the entire Unicode character set, but only for those characters that are relevant for the locale. While the Unicode Collation Algorithm combines a default collation order for the entire Unicode character set with the ability to tailor for local conventions, subsets and tailorings still result in differences in behaviour.

Most likely, the order of @ vs. _ just isn't significantly defined in the locales you're using (or mine; UK English), and so you get "differences in behavior."

What is correct way to implement this? (Check data type; if string use localeCompare else conditional operator?)

Yes. > and < use the numeric relationship of the code points in the Unicode standard, which isn't really a very good way to handle collation at all, while localeCompare provides a locale-specific collation to characters.

To be clear: When you say you "...used conditional operator", I assume you mean the conditional operator (? :) combined with a relational operator (> or < in this case), e.g. something like:

```<code>return a === b ? 0 : a > b ? 1 : -1;
</code>```

...or similar in a sort callback.

But note that since you're now using localeCompare for strings, and the only other thing you can really meaningfully compare with > and < is numbers, there's a better solution for numbers if you know none of them is NaN: Just subtract:

```<code>return a - b; // For numbers that aren't NaN
</code>```

(If either of them may be NaN, you'll want to handle that — perhaps with the conditional operator. :-) )

Body:
While looking at one issue related to sorting, I came across interesting difference for non alpha numeric characters comparison between string localeCompare method and conditional operator (like >,<).

You can see difference between them by running below snippets in different browsers.

function comparison1(param1, param2){
  return param1 > param2;
}

function comparison2(param1, param2){
  return param1.localeCompare(param2);
}
document.getElementById("comparison11").innerHTML = comparison1('A', 'B');
document.getElementById("comparison12").innerHTML = comparison2('A', 'B');
document.getElementById("comparison21").innerHTML = comparison1('@', '_');
document.getElementById("comparison22").innerHTML = comparison2('@', '_');

    'A' > 'B'

    'A'.localeCompare('B')

    '@' > '_'

    '@'.localeCompare('_')

    returns -1 in IE and Edge but 1 in Chrome and Firefox

As you can see there is difference in response while comparing '@' and '_' when using localeCompare method and > operator in Chrome and Firefox.

We implemented comparison method for sorting that is called for multiple columns with different data types. So we used conditional operators, but as you can see it is providing different result for non alpha numeric characters in different browsers.

Here are my questions!

Why different response for special characters in different browsers?

What is correct way to implement this? (Check data type; if string use localeCompare else conditional operator?)

Body:
Why different response for special characters in different browsers?

Probably because as it says in the ECMA-402 (internationalization) spec:

Subsets of Unicode: Some operations, such as collation, operate on strings that can include characters from the entire Unicode character set. However, both the Unicode standard and the ECMAScript standard allow implementations to limit their functionality to subsets of the Unicode character set. In addition, locale conventions typically don’t specify the desired behaviour for the entire Unicode character set, but only for those characters that are relevant for the locale. While the Unicode Collation Algorithm combines a default collation order for the entire Unicode character set with the ability to tailor for local conventions, subsets and tailorings still result in differences in behaviour.

Most likely, the order of @ vs. _ just isn't significantly defined in the locales you're using (or mine; UK English), and so you get "differences in behavior."

What is correct way to implement this? (Check data type; if string use localeCompare else conditional operator?)

Yes. > and < use the numeric relationship of the code points in the Unicode standard, which isn't really a very good way to handle collation at all, while localeCompare provides a locale-specific collation to characters.

To be clear: When you say you "...used conditional operator", I assume you mean the conditional operator (? :) combined with a relational operator (> or < in this case), e.g. something like:

return a === b ? 0 : a > b ? 1 : -1;

...or similar in a sort callback.

But note that since you're now using localeCompare for strings, and the only other thing you can really meaningfully compare with > and < is numbers, there's a better solution for numbers if you know none of them is NaN: Just subtract:

return a - b; // For numbers that aren't NaN

(If either of them may be NaN, you'll want to handle that — perhaps with the conditional operator. :-) )


问:
How can I create an interactive object in pygame?
In a pygame program I am creating, I have need for an interactive object on the screen that will call a function when the player character moves onto it and presses the enter key. Here is the code I have so far:

```<code>import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
done = False
x = 30
y = 30

clock = pygame.time.Clock()

while not done:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        done = True

    pressed = pygame.key.get_pressed()
    if pressed[pygame.K_UP] and y > 0: y -= 5
    if pressed[pygame.K_DOWN] and y < 600 - 60: y += 5
    if pressed[pygame.K_LEFT] and x > 0: x -= 5
    if pressed[pygame.K_RIGHT] and x < 800 - 60: x += 5

    screen.fill((0, 0, 0))
    color = (0, 128, 255)
    pygame.draw.rect(screen, color, pygame.Rect(x, y, 60, 60))

    myfont = pygame.font.SysFont("monospace", 15)

    label = myfont.render("Start the experiment simulator", 1, (255,255,255))
    screen.blit(label, (100, 100))

    label2 = myfont.render("Start the quiz", 1, (255,255,255))
    screen.blit(label2, (550, 100))

    label3 = myfont.render("Quit game", 1, (255,255,255))
    screen.blit(label3, (350, 400))

    pygame.draw.rect(screen, red, pygame.Rect(600, 125, 30, 30))
    pygame.draw.rect(screen, red, pygame.Rect(225, 125, 30, 30))
    pygame.draw.rect(screen, red, pygame.Rect(375, 425, 30, 30))

    pygame.display.flip()
    clock.tick(60)
</code>```

At the moment, the object is just a test so would be best to be a small red rectangle, about half the size of the player, that I can replace with an icon later on. This rectangle should be placed below the 'quit game' label on the pygame window and quit the game when interacted with. This is one method that I have tried so far:

```<code>if pressed[pygame.K_RETURN] and x >= 375 or x <= 405 and y >=425 or y <= 455:
            pygame.display.quit()
            pygame.quit()
            sys.exit()
</code>```

Where theoretically the system checks if the user is in a specific area and has pressed the enter key before performing the command.

答:
You can check for collision, using pygame's colliderect

First, create three rects that will represent your three option rects :

```<code>simulator_rect = pygame.Rect(600, 125, 30, 30)
quiz_rect = pygame.Rect(225, 125, 30, 30)
quit_rect = pygame.Rect(375, 425, 30, 30)
</code>```

Next, we'll create a rect that will represent the blue selector rect :

```<code>selector_rect = pygame.Rect(50, 50, 60, 60)
</code>```

So now you've got rects that are created only once, instead of unnamed rects that are created every time

Now, for the actual collision detection :

```<code># Check to see if the user presses the enter key
    if pressed[pygame.K_RETURN]:
        # Check to see if the selection rect
        # collides with any other rect
        for rect in option_rects:
            if selector_rect.colliderect(rect):
                if rect == simulator_rect:
                    # Do simulations stuff!
                    print('Simulating!')
                elif rect == quiz_rect:
                    # Do quizzing stuff!
                    print('Quizzing!')
                elif rect == quit_rect:
                    # Quit!
                    done = True
</code>```

Final code :

```<code>import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
done = False
x = 30
y = 30

clock = pygame.time.Clock()

# RGB values for red
red = (255, 0 ,0)

# Your three button rects :
simulator_rect = pygame.Rect(225, 125, 30, 30)
quiz_rect = pygame.Rect(600, 125, 30, 30)
quit_rect = pygame.Rect(375, 425, 30, 30)
# These represent your three option rects
option_rects = [simulator_rect, quiz_rect, quit_rect]

# Your blue selector rect
selector_rect = pygame.Rect(50, 50, 60, 60)
# The 50, 50 xy coords are temporary

while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

    pressed = pygame.key.get_pressed()
    if pressed[pygame.K_UP] and y > 0: y -= 5
    if pressed[pygame.K_DOWN] and y < 600 - 60: y += 5
    if pressed[pygame.K_LEFT] and x > 0: x -= 5
    if pressed[pygame.K_RIGHT] and x < 800 - 60: x += 5

    # Set the slector rect's coords to x/y
    selector_rect.x, selector_rect.y = x, y

    screen.fill((0, 0, 0))

    color = (0, 128, 255)
    pygame.draw.rect(screen, color, selector_rect)

    myfont = pygame.font.SysFont("monospace", 15)

    label = myfont.render("Start the experiment simulator", 1, (255,255,255))
    screen.blit(label, (100, 100))

    label2 = myfont.render("Start the quiz", 1, (255,255,255))
    screen.blit(label2, (550, 100))

    label3 = myfont.render("Quit game", 1, (255,255,255))
    screen.blit(label3, (350, 400))

    # Use our created rects
    pygame.draw.rect(screen, red, simulator_rect)
    pygame.draw.rect(screen, red, quiz_rect)
    pygame.draw.rect(screen, red, quit_rect)

    # Check to see if the user presses the enter key
    if pressed[pygame.K_RETURN]:
        # Check to see if the selection rect
        # collides with any other rect
        for rect in option_rects:
        # Add rects as needed
            if selector_rect.colliderect(rect):
                if rect == simulator_rect:
                    # Do simulations stuff!
                    print('Simulating!')
                elif rect == quiz_rect:
                    # Do quizzing stuff!
                    print('Quizzing!')
                elif rect == quit_rect:
                    # Quit!
                    done = True

    pygame.display.flip()
    clock.tick(60)
</code>```

This does add some complication to your program, but at least it's a rock solid method that you can add features too, and that will remain robust.

Body:
In a pygame program I am creating, I have need for an interactive object on the screen that will call a function when the player character moves onto it and presses the enter key. Here is the code I have so far:

import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
done = False
x = 30
y = 30

clock = pygame.time.Clock()

while not done:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        done = True

    pressed = pygame.key.get_pressed()
    if pressed[pygame.K_UP] and y > 0: y -= 5
    if pressed[pygame.K_DOWN] and y < 600 - 60: y += 5
    if pressed[pygame.K_LEFT] and x > 0: x -= 5
    if pressed[pygame.K_RIGHT] and x < 800 - 60: x += 5

    screen.fill((0, 0, 0))
    color = (0, 128, 255)
    pygame.draw.rect(screen, color, pygame.Rect(x, y, 60, 60))

    myfont = pygame.font.SysFont("monospace", 15)

    label = myfont.render("Start the experiment simulator", 1, (255,255,255))
    screen.blit(label, (100, 100))

    label2 = myfont.render("Start the quiz", 1, (255,255,255))
    screen.blit(label2, (550, 100))

    label3 = myfont.render("Quit game", 1, (255,255,255))
    screen.blit(label3, (350, 400))

    pygame.draw.rect(screen, red, pygame.Rect(600, 125, 30, 30))
    pygame.draw.rect(screen, red, pygame.Rect(225, 125, 30, 30))
    pygame.draw.rect(screen, red, pygame.Rect(375, 425, 30, 30))

    pygame.display.flip()
    clock.tick(60)

At the moment, the object is just a test so would be best to be a small red rectangle, about half the size of the player, that I can replace with an icon later on. This rectangle should be placed below the 'quit game' label on the pygame window and quit the game when interacted with. This is one method that I have tried so far:

if pressed[pygame.K_RETURN] and x >= 375 or x <= 405 and y >=425 or y <= 455:
            pygame.display.quit()
            pygame.quit()
            sys.exit()

Where theoretically the system checks if the user is in a specific area and has pressed the enter key before performing the command.

Body:
You can check for collision, using pygame's colliderect

First, create three rects that will represent your three option rects :

simulator_rect = pygame.Rect(600, 125, 30, 30)
quiz_rect = pygame.Rect(225, 125, 30, 30)
quit_rect = pygame.Rect(375, 425, 30, 30)

Next, we'll create a rect that will represent the blue selector rect :

selector_rect = pygame.Rect(50, 50, 60, 60)

So now you've got rects that are created only once, instead of unnamed rects that are created every time

Now, for the actual collision detection :

# Check to see if the user presses the enter key
    if pressed[pygame.K_RETURN]:
        # Check to see if the selection rect
        # collides with any other rect
        for rect in option_rects:
            if selector_rect.colliderect(rect):
                if rect == simulator_rect:
                    # Do simulations stuff!
                    print('Simulating!')
                elif rect == quiz_rect:
                    # Do quizzing stuff!
                    print('Quizzing!')
                elif rect == quit_rect:
                    # Quit!
                    done = True

Final code :

import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))
done = False
x = 30
y = 30

clock = pygame.time.Clock()

# RGB values for red
red = (255, 0 ,0)

# Your three button rects :
simulator_rect = pygame.Rect(225, 125, 30, 30)
quiz_rect = pygame.Rect(600, 125, 30, 30)
quit_rect = pygame.Rect(375, 425, 30, 30)
# These represent your three option rects
option_rects = [simulator_rect, quiz_rect, quit_rect]

# Your blue selector rect
selector_rect = pygame.Rect(50, 50, 60, 60)
# The 50, 50 xy coords are temporary

while not done:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True

    pressed = pygame.key.get_pressed()
    if pressed[pygame.K_UP] and y > 0: y -= 5
    if pressed[pygame.K_DOWN] and y < 600 - 60: y += 5
    if pressed[pygame.K_LEFT] and x > 0: x -= 5
    if pressed[pygame.K_RIGHT] and x < 800 - 60: x += 5

    # Set the slector rect's coords to x/y
    selector_rect.x, selector_rect.y = x, y

    screen.fill((0, 0, 0))

    color = (0, 128, 255)
    pygame.draw.rect(screen, color, selector_rect)

    myfont = pygame.font.SysFont("monospace", 15)

    label = myfont.render("Start the experiment simulator", 1, (255,255,255))
    screen.blit(label, (100, 100))

    label2 = myfont.render("Start the quiz", 1, (255,255,255))
    screen.blit(label2, (550, 100))

    label3 = myfont.render("Quit game", 1, (255,255,255))
    screen.blit(label3, (350, 400))

    # Use our created rects
    pygame.draw.rect(screen, red, simulator_rect)
    pygame.draw.rect(screen, red, quiz_rect)
    pygame.draw.rect(screen, red, quit_rect)

    # Check to see if the user presses the enter key
    if pressed[pygame.K_RETURN]:
        # Check to see if the selection rect
        # collides with any other rect
        for rect in option_rects:
        # Add rects as needed
            if selector_rect.colliderect(rect):
                if rect == simulator_rect:
                    # Do simulations stuff!
                    print('Simulating!')
                elif rect == quiz_rect:
                    # Do quizzing stuff!
                    print('Quizzing!')
                elif rect == quit_rect:
                    # Quit!
                    done = True

    pygame.display.flip()
    clock.tick(60)

This does add some complication to your program, but at least it's a rock solid method that you can add features too, and that will remain robust.


问:
How to block and inform threads
I have a List object in my class and two methods which are used to add and remove items from the list.

There are multiple threads trying to access the list.

I want to ensure that only one thread is updating the list at an instance.

If a list is empty and a thread wants to remove an item then I want to make the thread wait till there is an item in the list.

When an item is inserted in the list
then I want to inform other threads
which are waiting to access the list
that the list is not empty anymore
and they can remove the items (using events).

What is the best mechanism to achieve this goal?

答: ReaderWriterLock object will be a good fit - allows for parallel reads but will block all the other threads while one thread is writing to the collection.</p>

ContentLicense: CC BY-SA 2.5

Title: How to block and inform threads


问:
Error while using SparkSession or sqlcontext
I am new to spark. I am just trying to parse a json file using sparksession or sqlcontext.
But whenever I run them, I am getting the following error.

```<code>Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.spark.internal.config.package$.CATALOG_IMPLEMENTATION()Lorg/apache/spark/internal/config/ConfigEntry; at
org.apache.spark.sql.SparkSession$.org$apache$spark$sql$SparkSession$$sessionStateClassName(SparkSession.scala:930) at
org.apache.spark.sql.SparkSession.sessionState$lzycompute(SparkSession.scala:112) at
org.apache.spark.sql.SparkSession.sessionState(SparkSession.scala:110)  at
org.apache.spark.sql.DataFrameReader.<init>(DataFrameReader.scala:535)  at
org.apache.spark.sql.SparkSession.read(SparkSession.scala:595) at
org.apache.spark.sql.SQLContext.read(SQLContext.scala:504) at
joinAssetsAndAd$.main(joinAssetsAndAd.scala:21) at
joinAssetsAndAd.main(joinAssetsAndAd.scala)
</code>```

As of now I created a scala project in eclipse IDE and configured it as Maven project and added the spark and sql dependencies.

My dependencies :

<dependencies>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-sql_2.11</artifactId>
        <version>2.0.0</version>
    </dependency>
</dependencies>
```

Could you please explain why I am getting this error and how to correct them?

答: Try to use the same version for spark-core and spark-sql. Change version of spark-sql to 2.1.0

Body:
I am new to spark. I am just trying to parse a json file using sparksession or sqlcontext.
But whenever I run them, I am getting the following error.

Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.spark.internal.config.package$.CATALOG_IMPLEMENTATION()Lorg/apache/spark/internal/config/ConfigEntry; at
org.apache.spark.sql.SparkSession$.org$apache$spark$sql$SparkSession$$sessionStateClassName(SparkSession.scala:930) at
org.apache.spark.sql.SparkSession.sessionState$lzycompute(SparkSession.scala:112) at
org.apache.spark.sql.SparkSession.sessionState(SparkSession.scala:110)  at
org.apache.spark.sql.DataFrameReader.<init>(DataFrameReader.scala:535)  at
org.apache.spark.sql.SparkSession.read(SparkSession.scala:595) at
org.apache.spark.sql.SQLContext.read(SQLContext.scala:504) at
joinAssetsAndAd$.main(joinAssetsAndAd.scala:21) at
joinAssetsAndAd.main(joinAssetsAndAd.scala)

As of now I created a scala project in eclipse IDE and configured it as Maven project and added the spark and sql dependencies.

My dependencies :

<dependencies>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-sql_2.11</artifactId>
        <version>2.0.0</version>
    </dependency>
</dependencies>

Could you please explain why I am getting this error and how to correct them?


问:
Incompatible library version puma_http11.so
When I am running rake db:create in my ruby on rails project it's giving me error LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so

Here is full error

```<code>tps@tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-    2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-  3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top   (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
</code>```

Can anyone please help me?

Thanks in advance

答:
Try this(version 3.6.0):

gem uninstall puma

and

bundle

or try this

gem pristine --all

or for specific gem

gem pristine puma

Body:
When I am running rake db:create in my ruby on rails project it's giving me error LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so

Here is full error

tps@tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-    2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-  3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top   (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

Can anyone please help me?

Thanks in advance

ContentLicense: CC BY-SA 4.0


问:
ggplot bar plot with facet-dependent order of categories
I've seen many questions (often linked to Order Bars in ggplot2 bar graph) about how to (re)order categories in a bar plot.

What I am after is just a touch different, but I haven't found a good way to do it: I have a multi-faceted bar plot, and I want to order the x axis for each facet independently, according to another variable (in my case, that variable is just the y value itself, i.e. I just want the bars to go in increasing length in each facet).

Simple example, following e.g. Order Bars in ggplot2 bar graph:

```<code>df <- data.frame(name=c('foo','bar','foo','bar'),period=c('old','old','recent','recent'),val=c(1.23,2.17,4.15,3.65))
p = ggplot(data = df, aes(x = reorder(name, val), y = val))
p = p + geom_bar(stat='identity')
p = p + facet_grid(~period)
p
</code>```

What we get is the following:

Whereas what I want is:

答:
This is an old question but it's being used as a dupe target. So it might be worthwhile to suggest a solution which utilizes the recent enhancements of the ggplot2 package, namely the labels parameter to scale_x_discrete(). This avoids to use duplicate levels which is deprecated or to manipulate factor labels by prepending a varying number of spaces.

Prepare data

Here, the mpg dataset is used to have a comparison to this answer. For data manipulation, the data.tablepackage is used here but feel free to use whatever package you prefer for this purpose.

```<code>library(data.table)   # version 1.10.4
library(ggplot2)      # version 2.2.1
# aggregate data
df <- as.data.table(mpg)[, .(mixmpg = mean(cty + hwy)), by = .(year, manufacturer)]
# create dummy var which reflects order when sorted alphabetically
df[, ord := sprintf("%02i", frank(df, mixmpg, ties.method = "first"))]
</code>```

Create plot

```<code># `ord` is plotted on x-axis instead of `manufacturer`
ggplot(df, aes(x = ord, y = mixmpg)) +
  # geom_col() is replacement for geom_bar(stat = "identity")
  geom_col() +
  # independent x-axis scale in each facet,
  # drop absent factor levels (actually not required here)
  facet_wrap(~ year, scales = "free_x", drop = TRUE) +
  # use named character vector to replace x-axis labels
  scale_x_discrete(labels = df[, setNames(as.character(manufacturer), ord)]) +
  # replace x-axis title
  xlab(NULL) +
  # rotate x-axis labels
  theme(axis.text.x = element_text(angle = 90, hjust=1, vjust=.5))
</code>```

Body:
I've seen many questions (often linked to Order Bars in ggplot2 bar graph) about how to (re)order categories in a bar plot.

What I am after is just a touch different, but I haven't found a good way to do it: I have a multi-faceted bar plot, and I want to order the x axis for each facet independently, according to another variable (in my case, that variable is just the y value itself, i.e. I just want the bars to go in increasing length in each facet).

Simple example, following e.g. Order Bars in ggplot2 bar graph:

df <- data.frame(name=c('foo','bar','foo','bar'),period=c('old','old','recent','recent'),val=c(1.23,2.17,4.15,3.65))
p = ggplot(data = df, aes(x = reorder(name, val), y = val))
p = p + geom_bar(stat='identity')
p = p + facet_grid(~period)
p

What we get is the following:

Whereas what I want is:

Body:
This is an old question but it's being used as a dupe target. So it might be worthwhile to suggest a solution which utilizes the recent enhancements of the ggplot2 package, namely the labels parameter to scale_x_discrete(). This avoids to use duplicate levels which is deprecated or to manipulate factor labels by prepending a varying number of spaces.

Prepare data

Here, the mpg dataset is used to have a comparison to this answer. For data manipulation, the data.tablepackage is used here but feel free to use whatever package you prefer for this purpose.

library(data.table)   # version 1.10.4
library(ggplot2)      # version 2.2.1
# aggregate data
df <- as.data.table(mpg)[, .(mixmpg = mean(cty + hwy)), by = .(year, manufacturer)]
# create dummy var which reflects order when sorted alphabetically
df[, ord := sprintf("%02i", frank(df, mixmpg, ties.method = "first"))]

Create plot

# `ord` is plotted on x-axis instead of `manufacturer`
ggplot(df, aes(x = ord, y = mixmpg)) +
  # geom_col() is replacement for geom_bar(stat = "identity")
  geom_col() +
  # independent x-axis scale in each facet,
  # drop absent factor levels (actually not required here)
  facet_wrap(~ year, scales = "free_x", drop = TRUE) +
  # use named character vector to replace x-axis labels
  scale_x_discrete(labels = df[, setNames(as.character(manufacturer), ord)]) +
  # replace x-axis title
  xlab(NULL) +
  # rotate x-axis labels
  theme(axis.text.x = element_text(angle = 90, hjust=1, vjust=.5))


问:
How do I join multiple tables in SQL whose objects will be modeled using inheritance?
For my university assignment I have to design some basic managment system for sicknesses and all for a school. I have decided to model some basic inheritance in the form of

Person --> Student

Person --> Staff

Person --> Guardian

Person (PersonID, FirstName, LastName)

Student (StudentID (Which references the PersonID), ... )

The reason i decided to do this as I modeled this first in UML and had the inheritance in this.

I have another table which stored Incidents which have both StudentID, StaffID and GuardianID. However I was wondering how I would create a join in mysql which would display all three inherited people's names?

e.g.

Student.FirstName Student.LastName, Staff.FirstName, Staff.LastName etc...

How would I do this?

Or am i doing this completely wrong this way?

Thanks in advance.

http://pastebin.com/m263dd7 - Link to my DDL for the tables.

答:
This is not right. You should have a Person class, and other classes would determine that a certain Person is a Student, Staff, etc. What happens if you have a staff person that is also a student? What happens if the Student graduates?

It is a classic example of impedance mismatch between the relational model and the OO model.

You could have for example three tables:

PERSON

PersonId
LastName
FirstName

STUDENT
StudentId
PersonId

STAFF

StaffId
PersonId

OwnerDisplayName: Malachi

LastEditorDisplayName: Malachi


问:
filter: progid:DXImageTransform fails W3C CSS validation
I am using the following three lines in CSS to enable smooth transitions between "slides", but line #1 fails W3C CSS validation.

```<code>filter: progid:DXImageTransform.Microsoft.alpha(opacity=100);
-moz-opacity: 1;
opacity: 1;
</code>```

Is there a way to reformulate the same intent (smooth transitions through alpha blending) but with methods that won't fail validation?

答: You can use IE conditional comments to serve a different stylesheet with the filter in it.

Body:
I am using the following three lines in CSS to enable smooth transitions between "slides", but line #1 fails W3C CSS validation.

filter: progid:DXImageTransform.Microsoft.alpha(opacity=100);
-moz-opacity: 1;
opacity: 1;

Is there a way to reformulate the same intent (smooth transitions through alpha blending) but with methods that won't fail validation?


问:
Golang: How to use syscall.Syscall on Linux?
There is a very nice description about loading a shared library and calling a function with the syscall package on Windows (https://github.com/golang/go/wiki/WindowsDLLs). However, the functions LoadLibrary and GetProcAddress that are used in this description are not available in the syscall package on Linux. I could not find documentation about how to do this on Linux (or Mac OS).

Thanks for help

答:
Linux syscalls are used directly without loading a library, exactly how depends on which system call you would like to perform.

I will use the Linux syscall getpid() as an example, which returns the process ID of the calling process (our process, in this case).

```<code>package main

import (
    "fmt"
    "syscall"
)

func main() {
    pid, _, _ := syscall.Syscall(syscall.SYS_GETPID, 0, 0, 0)
    fmt.Println("process id: ", pid)
}
</code>```

I capture the result of the syscall in pid, this particular call returns no errors so I use blank identifiers for the rest of the returns. Syscall returns two uintptr and 1 error.

As you can see I can also just pass in 0 for the rest of the function arguments, as I don't need to pass arguments to this syscall.

The function signature is: func Syscall(trap uintptr, nargs uintptr, a1 uintptr, a2 uintptr, a3 uintptr) (r1 uintptr, r2 uintptr, err Errno).

For more information refer to https://golang.org/pkg/syscall/

Body:
Linux syscalls are used directly without loading a library, exactly how depends on which system call you would like to perform.

I will use the Linux syscall getpid() as an example, which returns the process ID of the calling process (our process, in this case).

package main

import (
    "fmt"
    "syscall"
)

func main() {
    pid, _, _ := syscall.Syscall(syscall.SYS_GETPID, 0, 0, 0)
    fmt.Println("process id: ", pid)
}

I capture the result of the syscall in pid, this particular call returns no errors so I use blank identifiers for the rest of the returns. Syscall returns two uintptr and 1 error.

As you can see I can also just pass in 0 for the rest of the function arguments, as I don't need to pass arguments to this syscall.

The function signature is: func Syscall(trap uintptr, nargs uintptr, a1 uintptr, a2 uintptr, a3 uintptr) (r1 uintptr, r2 uintptr, err Errno).

For more information refer to https://golang.org/pkg/syscall/


问:
How to find all rows with background-color yellow using jquery?
I would like to find all rows with attribute background-color=rgb(255, 255, 0).
Pressing on the button 'Search' should do this. I don't understand why this is not working. Nothing is found. Code for searching:

```<code>$("#btnSearch").click(function(){
  var rows = $("#tbl1 tr[style='background-color:rgb(255, 255, 0)']");
})
</code>```

Whole example is here

答:
The characters string you use should be the same on the jQuery and the HTML.

In your jQuery you forgot the semicolon ; and a space  after the :.

Try this string.

```<code>#tbl1 tr[style='background-color: rgb(255, 255, 0);']
</code>```

Anyway, I dont recomend you to use inline styles this way.

Body:
I would like to find all rows with attribute background-color=rgb(255, 255, 0).
Pressing on the button 'Search' should do this. I don't understand why this is not working. Nothing is found. Code for searching:

$("#btnSearch").click(function(){
  var rows = $("#tbl1 tr[style='background-color:rgb(255, 255, 0)']");
})

Whole example is here

Body:
The characters string you use should be the same on the jQuery and the HTML.

In your jQuery you forgot the semicolon ; and a space  after the :.

Try this string.

#tbl1 tr[style='background-color: rgb(255, 255, 0);']

Anyway, I dont recomend you to use inline styles this way.