Azure Flask HTTP Error 500.0 - INTERNAL SERVER ERROR

亡梦爱人 提交于 2019-11-29 12:10:49

Have you set app.secret_key before using session variable? I had same issue, it worked locally, but threw 'Internal Server Error' in azure, because I set it in if _name__ == '_main__' block like this:

if __name__ == '__main__':
  HOST = environ.get('SERVER_HOST', 'localhost')
  try:
      PORT = int(environ.get('SERVER_PORT', '5555'))
  except ValueError:
      PORT = 5555
  app.secret_key = "secret_key"    
  app.run(HOST, port=PORT)

I set app.secret_key = "secret_key" outside of the if block and it worked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!