Python龙卷风主管设置

Python tornado supervisor setup

我正在尝试使用 Supervisor 设置我的 tornado 应用程序

以下是我在supervisor中写的配置:

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)
chown=nobody:nogroup

[include]
files = /etc/supervisor/*.ini

文件的其余部分与默认文件相同。

tornado.ini 文件:

[program:tornado_main]
command=/home/ubuntu/env/bin/python /home/ubuntu/<repo>/__main__.py
directory=/home/ubuntu/<repo>
user=ubuntu
stdout_logfile = /var/log/supervisor/tornado_main.log
stderr_logfile = /var/log/supervisor/tornado_main_err.log

然后我运行, sudo service supervisor restart all 这 运行 是我的龙卷风应用程序

现在,当我尝试 运行 我的一个 API(比如 http://35.154.145.226:3000/questions/)时,它没有返回任何东西

它给我一个错误:

This site can’t be reached

35.154.145.226 took too long to respond.
Search Google for 154 145 226 3000
ERR_CONNECTION_TIMED_OUT

或"could not reach site"

我的日志文件中也没有添加日志。 不知何故,IP无法访问,我猜。

main.py 中的部分代码为:

class Application(tornado.web.Application):
    def __init__(self):
        settings = dict(
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            autoescape=None
        )
        tornado.web.Application.__init__(self, urls, **settings)
app = Application()
options.log_file_prefix = "tornado_log"
enable_pretty_logging(options=options)
app.listen(int(config.get('tornado', 'listening_port')))
tornado.autoreload.start()
tornado.ioloop.IOLoop.current().start()

我在这里错过了什么?

ERR_CONNECTION_TIMED_OUT

一个原因是:

EC2 (OR whichever you are using) security group has not allowed inbound connection for port no 3000