parent
2d03633204
commit
f2c4455441
@ -0,0 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
'''
|
||||
@File : app.py
|
||||
@License : (C)Copyright 2018-2022
|
||||
|
||||
@Modify Time @Author @Version @Desciption
|
||||
------------ ------- -------- -----------
|
||||
2023/4/13 14:26 zart20 1.0 None
|
||||
'''
|
||||
|
||||
from flask import Flask, render_template
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "<h1>hello</h1>"
|
||||
|
||||
@app.route('/hello/<name>')
|
||||
def hello_2(name):
|
||||
return render_template('hello.html', name=name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="127.0.0.1", port=8080, debug=True)
|
@ -0,0 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
'''
|
||||
@File : hello.py
|
||||
@License : (C)Copyright 2018-2022
|
||||
|
||||
@Modify Time @Author @Version @Desciption
|
||||
------------ ------- -------- -----------
|
||||
2023/4/13 12:40 zart20 1.0 None
|
||||
'''
|
||||
|
||||
|
||||
# hello world
|
||||
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "<p>Hello, world!</p>"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
'''
|
||||
@File : mysql_conn.py
|
||||
@License : (C)Copyright 2018-2022
|
||||
|
||||
@Modify Time @Author @Version @Desciption
|
||||
------------ ------- -------- -----------
|
||||
2023/4/13 13:59 zart20 1.0 None
|
||||
'''
|
||||
|
||||
import pymysql
|
||||
|
||||
db = pymysql.connect(host="127.0.0.1", port=3306, user='root', password="123123", charset="utf8", database="student")
|
||||
|
||||
cursor = db.cursor()
|
||||
|
||||
cursor.execute("show tables;")
|
||||
|
||||
data = cursor.fetchall()
|
||||
print(data)
|
||||
|
||||
cursor.close()
|
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello from flask</title>
|
||||
</head>
|
||||
<body>
|
||||
{% if name %}
|
||||
<h1>hello {{ name }}!</h1>
|
||||
{% else %}
|
||||
<h1>Hello World!</h1>
|
||||
{% endif %}
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue