recup code pour mu editor
This commit is contained in:
19
mu_code/templates/age.html
Normal file
19
mu_code/templates/age.html
Normal file
@ -0,0 +1,19 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Age-o-meter</h1>
|
||||
|
||||
<p>How old are you..?
|
||||
|
||||
<form action="/age" method="post">
|
||||
{% if error %}
|
||||
<p><strong>{{error}}</strong></p>
|
||||
{% endif %}
|
||||
<label for="dob">Please enter your date of birth:</label>
|
||||
<input type="text" name="dob" placeholder="YYYY-MM-DD">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
{% if days_old %}
|
||||
<p>Your are <strong>{{days_old}}</strong> days old.</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
23
mu_code/templates/base.html
Normal file
23
mu_code/templates/base.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}Hello from Mu! :-){% endblock %}</title>
|
||||
<meta name="description" content="A big hello from Mu">
|
||||
<meta name="author" content="Add your name here">
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="/static/css/normalize.css">
|
||||
<link rel="stylesheet" href="/static/css/skeleton.css">
|
||||
<!-- Javascript
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<!-- Mobile Specific Metas (Do not change)
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
5
mu_code/templates/greeting.html
Normal file
5
mu_code/templates/greeting.html
Normal file
@ -0,0 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>Hello!</h1>
|
||||
<p>Hello {{name}}, how are you?</p>
|
||||
{% endblock %}
|
32
mu_code/templates/index.html
Normal file
32
mu_code/templates/index.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="two columns"><img src="/static/img/logo.png" alt="logo"/></div>
|
||||
<div class="ten columns"><h1>Hello from Mu!</h1></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>This is a very simple dynamic web application built using Python and
|
||||
the
|
||||
<a href="http://flask.pocoo.org/" target="_new">Flask web framework</a>.</p>
|
||||
|
||||
<p>Why not try adding the following route to your Python code?</p>
|
||||
|
||||
<pre><code>
|
||||
@app.route('/hello/<name>')
|
||||
def greet(name='Stranger'):
|
||||
return render_template("greeting.html", name=name)
|
||||
</code></pre>
|
||||
|
||||
<p>Now add the following template with the filename, "greeting.html".</p>
|
||||
<pre><code>
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<p>Hello {{name}}, how are you?</p>
|
||||
{% endblock %}
|
||||
</code></pre>
|
||||
|
||||
<p>Once you've done that, go visit
|
||||
<a href="/hello/yourname">/hello/yourname</a> (but replace "yourname" in
|
||||
the address bar with, you know, your actual name). :-)</p>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user