21 lines
710 B
Python
21 lines
710 B
Python
from flask import Flask, render_template
|
|
import os
|
|
from datetime import datetime
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.route("/")
|
|
def hello():
|
|
return '''Flask inside Docker!!<br><br>
|
|
<a href="/beautiful" style="display: inline-block; background-color: #3498db; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px; font-family: Arial, sans-serif;">查看美观页面</a>'''
|
|
|
|
@app.route("/beautiful")
|
|
def beautiful_page():
|
|
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
return render_template("beautiful.html", current_time=current_time)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
port = int(os.environ.get("PORT", 5000))
|
|
app.run(debug=True,host='0.0.0.0',port=port)
|