【发布时间】:2020-03-21 05:52:03
【问题描述】:
以下示例代码:
#!/usr/bin/python3
from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, EarthLocation, get_body
print('Content-Type:text/html;charset=utf-8\n')
t = Time("2014-09-22 23:22")
loc = EarthLocation.of_site('greenwich')
with solar_system_ephemeris.set('builtin'):
jup = get_body('jupiter', t, loc)
print('<h2>',jup.ra.deg,'</h2>')
脚本在本地运行时可以正常工作 (=136.9111620895066)。但如果我尝试从服务器执行它,则会出现“504 Gateway Time-out”Nginx 错误。
也许 astropy 保存星历表数据的文件有问题?其他 astropy、matplotlib 等脚本在服务器上运行良好。每次脚本需要 ephemerides flles (jpl, esa ...) 时都会出现该错误。
【问题讨论】:
-
你也可以发布你的 Nginx 配置吗?
-
你是如何调用这个脚本的(例如客户端——Nginx——脚本)?该错误意味着 Nginx 正在等待响应以返回给客户端(或调用此脚本的任何人),但您的脚本没有提供响应(即它只是
prints 到标准输出)。 -
isn't print('
',jup.ra.deg,'
') 应该将标签内的结果返回给客户端?