在Heroku托管的Flask应用中,我使用以下代码启动服务器:
if __name__ == '__main__': # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)在本地开发时,它将使用端口5000,在生产
PORT环境中,Heroku将设置环境变量。

在Heroku托管的Flask应用中,我使用以下代码启动服务器:
if __name__ == '__main__': # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000)) app.run(host='0.0.0.0', port=port)在本地开发时,它将使用端口5000,在生产
PORT环境中,Heroku将设置环境变量。