forked from liukai234/python_course_record
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liukai234
committed
May 30, 2020
1 parent
f5278fe
commit cb7b720
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
# 静态文件 | ||
# 静态文件 | ||
from flask import Flask | ||
from flask import render_template | ||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def index(): | ||
return render_template('index.html') | ||
|
||
# 通过路由处理页面间的跳转 | ||
@app.route('/r404/') | ||
def r404(): | ||
return render_template('404.html') | ||
|
||
app.run(host='0.0.0.0', port=19722) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
<h1>Hello World!</h1> | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
|
||
</head> | ||
|
||
<body> | ||
<h1>Hello World!</h1> | ||
<!--标记路由--> | ||
<a href="{{ url_for('r404') }}">404</a> | ||
<!--img css js的静态文件使用的路由--> | ||
<img src="{{ url_for('static', filename='img/main.jpg') }}" | ||
</body> | ||
|
||
</html> |