Skip to content

Commit 631fc37

Browse files
committed
Add template inheritance
1 parent 2814e21 commit 631fc37

12 files changed

+92
-0
lines changed

.flaskenv

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FLASK_APP=flask_auth.py
2+
FLASK_ENV=development
3+
FLASK_DEBUG=True

__pycache__/flask_auth.cpython-38.pyc

210 Bytes
Binary file not shown.

app/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import Flask
2+
from flask_bootstrap import Bootstrap
3+
4+
app = Flask(__name__)
5+
bootstrap = Bootstrap(app)
6+
7+
from app import routes, models, errors
381 Bytes
Binary file not shown.

app/__pycache__/errors.cpython-38.pyc

186 Bytes
Binary file not shown.

app/__pycache__/models.cpython-38.pyc

186 Bytes
Binary file not shown.

app/__pycache__/routes.cpython-38.pyc

434 Bytes
Binary file not shown.

app/routes.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from app import app
2+
from flask import render_template
3+
4+
5+
@app.route('/')
6+
@app.route('/index')
7+
def index():
8+
return render_template('index.html', title='Home')

app/templates/base.html

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{% extends 'bootstrap/base.html' %}
2+
3+
{% block title %}
4+
{% if title %}
5+
{{ title }} - Flask Auth
6+
{% else %}
7+
Welcome to Third Party Authentication
8+
{% endif %}
9+
{% endblock %}
10+
11+
{% block navbar %}
12+
<nav class="navbar navbar-default">
13+
<div class="container">
14+
<div class="navbar-header">
15+
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
16+
<span class="sr-only">Toggle navigation</span>
17+
<span class="icon-bar"></span>
18+
<span class="icon-bar"></span>
19+
<span class="icon-bar"></span>
20+
</button>
21+
<a class="navbar-brand" href="{{ url_for('index') }}">Flask Auth</a>
22+
</div>
23+
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
24+
<ul class="nav navbar-nav">
25+
<li><a href="{{ url_for('index') }}">Home</a></li>
26+
</ul>
27+
</div>
28+
</div>
29+
</nav>
30+
{% endblock %}
31+
32+
{% block content %}
33+
<div class="container">
34+
{% with messages = get_flashed_messages() %}
35+
{% if messages %}
36+
{% for message in messages %}
37+
<div class="alert alert-info" role='alert'>
38+
{{ message }}
39+
</div>
40+
{% endfor %}
41+
{% endif %}
42+
{% endwith %}
43+
44+
{% block app_content %}{% endblock %}
45+
</div>
46+
{% endblock %}

app/templates/index.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends 'base.html' %}
2+
3+
{% block app_content %}
4+
<h1>Hi, you!</h1>
5+
{% endblock %}

flask_auth.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from app import app

requirements.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
alembic==1.5.5
2+
click==7.1.2
3+
dnspython==2.1.0
4+
dominate==2.6.0
5+
email-validator==1.1.2
6+
Flask==1.1.2
7+
Flask-Bootstrap==3.3.7.1
8+
Flask-Login==0.5.0
9+
Flask-Migrate==2.7.0
10+
Flask-SQLAlchemy==2.4.4
11+
idna==3.1
12+
itsdangerous==1.1.0
13+
Jinja2==2.11.3
14+
Mako==1.1.4
15+
MarkupSafe==1.1.1
16+
python-dateutil==2.8.1
17+
python-dotenv==0.15.0
18+
python-editor==1.0.4
19+
six==1.15.0
20+
SQLAlchemy==1.3.23
21+
visitor==0.1.3
22+
Werkzeug==1.0.1

0 commit comments

Comments
 (0)