38 lines
814 B
Python
38 lines
814 B
Python
from flask import Flask
|
|
from flask import render_template
|
|
from flask import Flask, request, jsonify
|
|
import threading
|
|
import requests, socket
|
|
|
|
# from flask_cors import CORS
|
|
|
|
class Website(threading.Thread):
|
|
def __init__(self):
|
|
threading.Thread.__init__(self)
|
|
|
|
self.app = Flask(__name__)
|
|
# CORS(self.app)
|
|
|
|
#前端顯示
|
|
self.app.add_url_rule('/', 'Index', self.Demo)
|
|
self.app.add_url_rule('/next/<id>', 'Next', self.Next)
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
#self.app.run()
|
|
self.app.run(host="0.0.0.0", port="5500")
|
|
|
|
# 前端
|
|
def Demo(self):
|
|
return render_template('Demo.html')
|
|
def Next(self,id): # 攜帶參數
|
|
return render_template('Demo_next.html',id = id)
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
website = Website()
|
|
website.run() |