“执行python cgi脚本时“ 504网关超时”

问题描述 投票:1回答:1

以下示例代码:

#!/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网关超时” Nginx错误。

也许星号保存星历表数据的文件有问题吗?其他astropy,matplotlib等脚本可从服务器正常运行。每当脚本需要使用星历表文件时,都会出现该错误(jpl,esa ...)。

python nginx astropy
1个回答
0
投票

请确保您拥有astropy的最新错误修正版本(v3.2.3,http://docs.astropy.org/en/latest/changelog.html#id153,因为它解决了IERS URL的问题,这很可能导致您出现“ 504网关超时”错误。

© www.soinside.com 2019 - 2024. All rights reserved.