Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions stage1/taozhengbin/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
from flask import Flask,render_template

app = Flask(__name__)

nickname=['咸鱼','juju','dalao','大腿','油条','萌新']

@app.route('/step1/')
def step1():
return 'Hello World'

@app.route('/step2/')
def step2():
return render_template('step2.html')

@app.route('/step3/<name>/<address>/')
def step3(name,address):
return render_template('content.html',name=name,address=address,nickname=nickname)

if __name__ == '__main__':
app.run(debug= True)
5 changes: 5 additions & 0 deletions stage1/taozhengbin/static/css/step2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h1{color: orange;
text-align:center;
font-size:50px;
text-shadow: 3px 3px 3px #666666;
}
Binary file added stage1/taozhengbin/static/img/images.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions stage1/taozhengbin/static/js/step2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function sayhello(){
alert("Welcome!It's working well!!!");
}
12 changes: 12 additions & 0 deletions stage1/taozhengbin/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
{% block head %}
<title>Welcome site - {% block title %}{% endblock %}</title>
{% endblock %}
</head>

<body>
{% block body %}
{% endblock %}
</body>
</html>
23 changes: 23 additions & 0 deletions stage1/taozhengbin/templates/content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "base.html" %}

{% block title %} {{ name }} {% endblock%}

{% block head %}
{{ super() }}
{% endblock %}

{% block body %}
<h1>Hello, {{ name }}!, You are {{ address }}.</h1>
<hr />

<ul>
{% for each in nickname %}
{% if each == address %}
<b> <li> {{ each }} </li> </b>
{% else %}
<li> {{ each }} </li>
{% endif %}
{% endfor %}
</ul>
{% endblock %}

18 changes: 18 additions & 0 deletions stage1/taozhengbin/templates/step2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<title>Step2</title>
<link rel ="stylesheet" type="text/css" href="{{ url_for('static',filename = 'css/step2.css') }}" />
<script type = "text/javascript"
src= "{{ url_for('static', filename= 'js/step2.js') }}" >
</script>
</head>

<body>
<h1>Hello,Everyone!</h1>
<hr />
<img src="{{ url_for('static', filename='img/images.jpg') }}" alt="Hello image" />
<hr />
<input type="button" onclick="sayhello()" value="click here"/>
</body>

</html>