简体   繁体   中英

Running supervisor on an Amazon EC2 linux instance

I am running a python flask app on an amazon ec2 linux instace. MY python app looks like:
application.py

#!flask/bin/python

    from flask import Flask

    application = Flask(__name__)

    @application.route('/', methods=['GET', 'POST'])
    def index():
        return '{"Output":"Hello World"}'

    if __name__ == '__main__':
        application.run(host='0.0.0.0', port=80, debug=False)  

my supervisor config looks like:
supervisor.conf

[program:flaskapplication]
command = /home/ec2-user/myapp/venv/bin/python /home/ec2-user/myapp/application.py
stdout_logfile = /var/log/watcher-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
stderr_logfile = /var/log/watcher-stderr.log
stderr_logfile_maxbytes = 10MB
stderr_logfile_backups = 5

When I do the following command:

supervisorctl -c supervisor.conf

I get the following response:

00:00:00 /home/ec2-user/myapp/venv/bin/python2.7 /home/ec2-user/myapp/venv/bin/supervisord -c supervisor.conf

But when I hit the Amazon instance link, nothing is displayed. I get a server not responding page. What am I doing wrong?

我认为您可能需要一个终点:

>>> @application.route('/say_hi', methods=['POST'])

I realized that port 80 by default is not configured to be an incoming port in the EC2 security group. Once I added port 80 to be a verified incoming group, I was able to run the application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM