mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-08 14:08:20 -06:00
Move highly-static routes in separate blueprint
This commit is contained in:
3
app.py
3
app.py
@@ -51,6 +51,9 @@ def create_app():
|
|||||||
from route_forms import blueprint as forms_blueprint
|
from route_forms import blueprint as forms_blueprint
|
||||||
app.register_blueprint(forms_blueprint)
|
app.register_blueprint(forms_blueprint)
|
||||||
|
|
||||||
|
from static_routes import blueprint as static_blueprint
|
||||||
|
app.register_blueprint(static_blueprint)
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(e):
|
def page_not_found(e):
|
||||||
# note that we set the 404 status explicitly
|
# note that we set the 404 status explicitly
|
||||||
|
|||||||
19
routes.py
19
routes.py
@@ -19,11 +19,6 @@ def index(): # put application's code here
|
|||||||
return render_template('layouts/index.html', new_users=users, stats=stats)
|
return render_template('layouts/index.html', new_users=users, stats=stats)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/about')
|
|
||||||
def about():
|
|
||||||
return render_template('pages/about.html')
|
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/users')
|
@blueprint.route('/users')
|
||||||
def browse():
|
def browse():
|
||||||
users = User.query.all()
|
users = User.query.all()
|
||||||
@@ -87,20 +82,6 @@ def edit_user(username: str):
|
|||||||
form.process(obj=user)
|
form.process(obj=user)
|
||||||
return render_template('pages/user_edit.html', form=form)
|
return render_template('pages/user_edit.html', form=form)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/terms_of_service')
|
|
||||||
def tos():
|
|
||||||
return render_template('static/tos.html')
|
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/privacy')
|
|
||||||
def privacy():
|
|
||||||
return render_template('static/privacy.html')
|
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/license')
|
|
||||||
def license():
|
|
||||||
return render_template('static/license.html')
|
|
||||||
# @blueprint.route('/blogs')
|
# @blueprint.route('/blogs')
|
||||||
# def blogs():
|
# def blogs():
|
||||||
# return render_template('pages/blogs.html')
|
# return render_template('pages/blogs.html')
|
||||||
|
|||||||
23
static_routes.py
Normal file
23
static_routes.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from flask import Blueprint, redirect, render_template, url_for, request
|
||||||
|
|
||||||
|
blueprint = Blueprint('static', __name__)
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/about')
|
||||||
|
def about():
|
||||||
|
return render_template('pages/about.html')
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/terms_of_service')
|
||||||
|
def tos():
|
||||||
|
return render_template('static/tos.html')
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/privacy')
|
||||||
|
def privacy():
|
||||||
|
return render_template('static/privacy.html')
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/license')
|
||||||
|
def license():
|
||||||
|
return render_template('static/license.html')
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
created by <a href="https://github.com/Xevion">Ryan Walters</a> and <a href="https://github.com/Seligmann">Zachary Seligman</a>
|
created by <a href="https://github.com/Xevion">Ryan Walters</a> and <a href="https://github.com/Seligmann">Zachary Seligman</a>
|
||||||
</p>
|
</p>
|
||||||
<ul class="links">
|
<ul class="links">
|
||||||
<li><a href="{{ url_for('main.license') }}">License</a></li>
|
<li><a href="{{ url_for('static.license') }}">License</a></li>
|
||||||
<li><a href="{{ url_for('main.tos') }}">Terms of Service</a></li>
|
<li><a href="{{ url_for('static.tos') }}">Terms of Service</a></li>
|
||||||
{# <li><a href="{{ url_for('main.privacy') }}">Privacy</a></li>#}
|
{# <li><a href="{{ url_for('static.privacy') }}">Privacy</a></li>#}
|
||||||
<li><a href="{{ url_for('main.about') }}">About</a></li>
|
<li><a href="{{ url_for('static.about') }}">About</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="copyright">
|
<p class="copyright">
|
||||||
<a href="{{ url_for('main.index') }}">©2022 Runnerspace.live All Rights Reserved.</a>
|
<a href="{{ url_for('main.index') }}">©2022 Runnerspace.live All Rights Reserved.</a>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
{# <li><a href="{{ url_for('main.messages') }}">My Messages</a></li>#}
|
{# <li><a href="{{ url_for('main.messages') }}">My Messages</a></li>#}
|
||||||
{# <li><a href="{{ url_for('main.blogs') }}">Blog</a></li>#}
|
{# <li><a href="{{ url_for('main.blogs') }}">Blog</a></li>#}
|
||||||
{# <li><a href="{{ url_for('main.groups') }}">Groups</a></li>#}
|
{# <li><a href="{{ url_for('main.groups') }}">Groups</a></li>#}
|
||||||
<li><a href="{{ url_for('main.about') }}">About</a></li>
|
<li><a href="{{ url_for('static.about') }}">About</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user