我按照在线文档安装了GNU health FHIR REST server。
我成功地在服务器上运行了REST服务器应用程序。根据文档, 我的服务器上应该有以下端点可用:
List all patients (http://localhost:5000/Patient)
Show info for patient id #1 (http://localhost:5000/Patient/1)
List all patients with ana in name (http://localhost:5000/Patient?name=ana)
# etc ...
这是用于启动Tornado服务器的Python代码:
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.options import define, options
from app import create_app
from config import ProductionConfig
define("port", default=5000, help="Port to listen on", type=int)
#app = create_app(config=ProductionConfig)
app = create_app() #DebugConfig
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(options.port)
IOLoop.instance().start()
我使用curl
尝试查询服务器:
curl http://localhost:5000/Patient
curl: (7) Failed to connect to localhost port 5000: Connection refused
注意:从上面粘贴的代码中可以猜测,Tornado服务器正在监听5000端口。我修改了代码以打印`options.port`的值,但由于某些原因,它没有被打印到控制台上;同时也未能将该值记录到文件中(文件未写入,并且没有错误消息)-所以不确定发生了什么。
我使用`lsof`进行了双重检查,以查看哪些端口是打开的:
$ lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python2 23147 morpheous 4u IPv6 592698 0t0 TCP localhost:51950->localhost:8000 (ESTABLISHED)
我需要帮助确定Tornado正在运行的端口,以便我可以使用curl查询REST API。
listen
不是alive
,任何套接字都可以在没有OK
信号的情况下运行吗? - dsgdfgProductionConfig
和create_app
中有什么内容? - Oluwafemi Sulelsof -P |grep "^Python .*(LISTEN)$"
命令。我认为你的端口可能被覆盖在ProductionConfig
或create_app
中。 - Oluwafemi Sule