I deployed a web app to the google app engine in the past and it works fine. I recently had to make some changes to the python code, it runs fine locally and upon deploying it again, some charts don't show up. (https://leo-satellite-overview.nw.r.appspot.com/).
Checking the Error Reporting: It's showing two errors
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.celestrak.org'. (_ssl.c:1129)
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.celestrak.org'. (_ssl.c:1129).
Please see details of the errors link
See the code that returns the two charts
`@app.callback(
Output('satellite map', 'figure'),
Output('altitude chart', 'figure'),
Input('interval-component', 'n_intervals'),
Input('satellites dropdown', 'value'))
def plot_map(n, satellite_name):
try:
lon_list = []
lat_list = []
alt_list = []
obj_name_list = []
time_list = []
time = datetime.now()
orb = Orbital(satellite_name)
lon, lat = orb.get_lonlatalt(time)[0], orb.get_lonlatalt(time)[1]
lon_list.append(lon)
lat_list.append(lat)
obj_name_list.append(satellite_name)
for i in range(121):
time_list.append(time-timedelta(minutes = i))
for i in time_list:
alt_list.append(orb.get_lonlatalt(i)[2])
df_4 = pd.DataFrame({'ObjectName': obj_name_list, 'Latitude': lat_list, 'Longitude': lon_list})
df_5 = pd.DataFrame({'TimeStamp': time_list, 'Altitude': alt_list})
lon_list.clear()
lat_list.clear()
alt_list.clear()
time_list.clear()
obj_name_list.clear()
df_4_copy = df_4.copy()
df_5_copy = df_5.copy()
fig =go.Figure(go.Scattermapbox(
lat = df_4_copy['Latitude'], lon = df_4_copy['Longitude'], marker = {'size': 20, 'symbol':'rocket'},
hovertext = df_4_copy['ObjectName'],
)
)
fig.update_layout(
mapbox = {'accesstoken':api_token,
'style': 'light', 'zoom': 0,
},
margin = dict(l = 0, r =0, t = 0, b = 0),
height = 800, hovermode = 'closest')
fig2 = go.Figure(go.Scatter(x = df_5_copy['TimeStamp'], y = df_5_copy['Altitude']))
fig2.update_layout(margin = dict(l = 20, r = 20, t = 20, b = 20),
plot_bgcolor = 'rgb(255,255,255)', paper_bgcolor = 'rgb(255,255,255)',
height = 800, title = {'text': 'Altitude Trend of' ' ' str(satellite_name) ' ' 'in near real time', 'x':0.5, 'y':0.98},
).update_yaxes(gridcolor = 'rgb(243,243,243)', title ='Altitude (km)').update_xaxes(title = 'Timestamp', linecolor = 'rgb(243,243,243)')
return fig, fig2
except NotImplementedError:
pass`
The full code is here: https://github.com/0ladayo/Low-Earth-Orbit-Satellites-Project/blob/master/main.py
I have tried some suggested solutions on the web to no avail.
Can anyone help
Thank you.
CodePudding user response:
It seems the issue was with the pyorbital
library which was using the wrong endpoints making the SSL issue appear.
For now there is already a fix and now it is released.
This is the reason the app was failing when retrieving data.
CodePudding user response:
Update
Based on the comments, OP doesn't own the domain which means OP is not responsible for getting a multi-domain SSL or using the SSL provided by google cloud. I am striking out the previous answer.
It seems like OP's code is attempting to load urls whose domain is
https://celestrak.org
but the SSL for that domain is actually forhttps://celestrak.com
. But can't figure it out yet.
- Another option is to use the Google Cloud issued SSL certificate i.e. login to
console.cloud.google.com
, select your project, then navigateApp Engine > Settings > Custom Domains
, select your custom domain and click theEnable Managed Security
.
Note: You won't get the mismatched certificate error in Firefox. Firefox simply changes your site to http