File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -206,5 +206,9 @@ def answer(topic=None):
206206 return result
207207 return Response (result , mimetype = 'text/plain' )
208208
209- SRV = WSGIServer ((SERVER_ADDRESS , SERVER_PORT ), app ) # log=None)
210- SRV .serve_forever ()
209+ if 'CHEATSH_PORT' in os .environ :
210+ SRV = WSGIServer ((SERVER_ADDRESS , int (os .environ .get ('CHEATSH_PORT' ))), app ) # log=None)
211+ SRV .serve_forever ()
212+ else :
213+ SRV = WSGIServer ((SERVER_ADDRESS , SERVER_PORT ), app ) # log=None)
214+ SRV .serve_forever ()
Original file line number Diff line number Diff line change @@ -471,7 +471,8 @@ def _rewrite_section_name_for_q(query):
471471 topic = "q:" + topic
472472 needs_beautification = True
473473
474- answer = REDIS .get (topic )
474+ if REDIS :
475+ answer = REDIS .get (topic )
475476 if answer :
476477 answer = answer .decode ('utf-8' )
477478
@@ -488,8 +489,9 @@ def _rewrite_section_name_for_q(query):
488489 answer = _get_unknown (topic )
489490
490491 # saving answers in the cache
491- if topic_type not in ["search" , "internal" , "unknown" ]:
492- REDIS .set (topic , answer )
492+ if REDIS :
493+ if topic_type not in ["search" , "internal" , "unknown" ]:
494+ REDIS .set (topic , answer )
493495
494496 if needs_beautification :
495497 filetype = 'bash'
You can’t perform that action at this time.
0 commit comments