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
8 changes: 8 additions & 0 deletions stage1/xwh/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
click===6.6
Flask==0.11.1
itsdangerous==0.24
jinja2==2.8
MarkupSafe==0.23
requests==2.11.1
virtualenv==15.1.0
Werkzeug==0.11.11
Binary file added stage1/xwh/static/001.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions stage1/xwh/static/css/hello.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#mark{color:red}
2 changes: 2 additions & 0 deletions stage1/xwh/static/css/hello_world.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
h1{color:red;
margin-left:20px;}
Binary file added stage1/xwh/static/img/001.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions stage1/xwh/static/js/hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
document.getElementById("target").onclick=function(){display()};
function display()
{
alert('afafww');
}
20 changes: 20 additions & 0 deletions stage1/xwh/task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from flask import Flask,render_template
app=Flask(__name__)


@app.route('/step1')
def hello_world1():
return 'Hello World!'
@app.route('/step2')
def hello_world2():
return render_template('hello_world2.html')
@app.route('/step3/<tag>/<name>/')
def hello(tag, name):
tag_list = ['xianyu', 'juju', 'dalao', 'datui', 'youtiao', 'mengxin']
for list in tag_list:
if list == tag:
return render_template('hello.html',tag = list, name = name, tag_list = tag_list)
return render_template('hello.html',tag = 'other', name = name, tag_list = tag_list)

if __name__=='__main__':
app.run()
8 changes: 8 additions & 0 deletions stage1/xwh/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html>
<body>
{% block one %}
{% endblock %}
{% block two %}
{% endblock %}
</body>
</html>
19 changes: 19 additions & 0 deletions stage1/xwh/templates/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends "base.html" %}

{% block one %}
<h1>Hello, {{ name }}, You are {{ tag }}!</h1><br>
{% endblock %}


{% block two %}
{% for elm in tag_list %}
{% if elm == tag %}
<h2><font color="red">{{ elm }}</font></h2>
{% else %}
<h2>{{ elm }}</font></h2>
{% endif %}
{% endfor %}
{% if tag == 'other' %}
<h2><font color="green">other</font></h2>
{% endif %}
{% endblock %}
11 changes: 11 additions & 0 deletions stage1/xwh/templates/hello_world2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/static/css/hello_world.css" />
<script src="/static/js/hello_world.js"></script>
</head>
<body>
<h1>Hello World!</h1>
<img src="../static/001.jpeg">
<button id="target" onclick="display()">Display</button>
</body>
</html>