1. Purchase Tencent Cloud Lightweight Application Server
2. Open ports
3. XShell login server
4. Backend code
# 实例化 Flask
app = Flask(__name__)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# 服务返回
@app.route('/')
def hello_world():
return "hello world"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
5. Test api
Find the public network ip of the server in the Tencent cloud server
and enter: ip:5000 on the browser to access