【发布时间】:2017-06-16 16:15:36
【问题描述】:
我正在尝试使用 Supervisor 设置我的龙卷风应用程序
以下是我用 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
或“无法到达网站”
我的日志文件中也没有添加任何日志。 不知何故,我猜是无法访问 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()
我在这里错过了什么?
【问题讨论】:
-
先尝试在你的linux服务器上运行
/home/ubuntu/env/bin/python /home/ubuntu/<repo>/__main__.py,如果你可以在外面访问,那么你应该这样做。并确保做到sudo supervisorctl update -
即使在手动运行它并停止主管之后,我也无法访问它。
-
这意味着您的
EC2 security group不允许端口号为3000的入站连接。 -
是的,这就是问题所在。谢谢你:)
-
很高兴听到这个消息。你可以接受我的回答:)
标签: python tornado supervisord