From c9c42007ebac028dfeffbfbfb102962efcebe4dd Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 4 Aug 2020 22:30:21 -0500 Subject: [PATCH] remove all server sided form/page processing - now obsolete --- server/create_app.py | 31 ------------- server/routes.py | 23 ---------- server/static/sass/styles.scss | 43 ------------------ server/templates/base.html | 82 ---------------------------------- server/templates/episode.html | 17 ------- server/templates/error.html | 1 - server/templates/index.html | 14 ------ server/templates/season.html | 15 ------- 8 files changed, 226 deletions(-) delete mode 100644 server/routes.py delete mode 100644 server/static/sass/styles.scss delete mode 100644 server/templates/base.html delete mode 100644 server/templates/episode.html delete mode 100644 server/templates/error.html delete mode 100644 server/templates/index.html delete mode 100644 server/templates/season.html diff --git a/server/create_app.py b/server/create_app.py index 8ac0a72..1d90a58 100644 --- a/server/create_app.py +++ b/server/create_app.py @@ -24,20 +24,11 @@ def create_app(env=None): """ app = Flask(__name__) - # Add Sass middleware (black magic) - app.wsgi_app = SassMiddleware(app.wsgi_app, { - 'server': ('static/sass', 'static/css', '/static/css', False) - }) - # Load configuration values if not env: env = app.config['ENV'] app.config.from_object(configs[env]) - # Fixes poor whitespace rendering in templates - app.jinja_env.trim_blocks = True - app.jinja_env.lstrip_blocks = True - # Initialize Flask extensions csrf.init_app(app) cors.init_app(app) @@ -49,29 +40,7 @@ def create_app(env=None): """Provides specific Flask components to the shell.""" return {'app': app} - # Custom error handler page (all errors) - @app.errorhandler(HTTPException) - def handle_exception(e): - """Error handler, sends users to a custom error page template.""" - return render_template('error.html', exception=e), e.code - - @app.context_processor - def inject_debug(): - """ - Allows for testing for debug mode in jinja2 templates. - """ - return dict(debug=app.debug) - - @app.context_processor - def inject_data(): - BASE_DIR = os.path.dirname(os.path.abspath(__file__)) - with open(os.path.join(BASE_DIR, 'data', 'data.json'), 'r', encoding='utf-8') as file: - return dict(data=json.load(file)) - - # noinspection PyUnresolvedReferences with app.app_context(): - # noinspection PyUnresolvedReferences - from server import routes # noinspection PyUnresolvedReferences from server import api diff --git a/server/routes.py b/server/routes.py deleted file mode 100644 index be7ab47..0000000 --- a/server/routes.py +++ /dev/null @@ -1,23 +0,0 @@ -from flask import current_app, render_template, abort - -from server.helpers import check_validity - - -@current_app.route('/') -def index(): - """Index page.""" - return render_template('index.html') - - -@current_app.route('/') -def view_season(season): - if not check_validity(season, 1): - abort(404) - return render_template('season.html', season=season) - - -@current_app.route('//') -def view_episode(season, episode): - if not check_validity(season, episode): - abort(404) - return render_template('episode.html', season=season, episode=episode) diff --git a/server/static/sass/styles.scss b/server/static/sass/styles.scss deleted file mode 100644 index 99027a2..0000000 --- a/server/static/sass/styles.scss +++ /dev/null @@ -1,43 +0,0 @@ -.accordion .list-group-item { - border-radius: 0; - border-width: 0 0 0 0; - border-bottom-width: 1px; - .list-group-item:first-child { border-top-width: 1px; } - .list-group-item:last-child { border-bottom-width: 0; } - - padding-left: 30px; - font-weight: 500; -} - -.accordion .list-group-item a { - //color: #61656b; - display: block; -} - -.accordion .list-group-item .badge { - float: right; - min-width: 36px; -} - -.accordion .card-body { - padding: 0; -} - -.card-header { - background-color: rgba(0, 0, 0, 0); - border-bottom: 1px solid rgba(0, 0, 0, .125); -} - -.card { - border: 1px solid rgba(0, 0, 0, .125); - border-bottom-color: rgba(0, 0, 0, 0.125); - border-radius: 0; -} - -.no-link { - text-decoration: none; -} - -.no-link:hover { - text-decoration: none; -} \ No newline at end of file diff --git a/server/templates/base.html b/server/templates/base.html deleted file mode 100644 index 17dbbec..0000000 --- a/server/templates/base.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - {% block head %} - - - - {# Site scripts #} - - - - - {# CSRF Tokens #} - - {# Stylesheets #} - - - OfficeQuotes{{ ' | ' ~ title if title }} - {% endblock %} - - - {% block content %} -
-
-
-
- {% for season in data %} -
- -
-
- -
-
-
- {% endfor %} -
-
- {% block page %} -
-
-
-

- Season {{ season }} Episode {{ episode }} -

-
- -
-
-
-
- {% endblock page %} -
-
- {% endblock %} - - \ No newline at end of file diff --git a/server/templates/episode.html b/server/templates/episode.html deleted file mode 100644 index 78c0ecd..0000000 --- a/server/templates/episode.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends 'base.html' %} -{% set episode_data = data[season - 1]['episodes'][episode - 1] %} -{% block page %} -
-
-
-

- Season {{ season }}, Episode {{ episode }} - {{ episode_data.title }} -

-
- -
- {{ episode_data.description }} -
-
-
-{% endblock page %} \ No newline at end of file diff --git a/server/templates/error.html b/server/templates/error.html deleted file mode 100644 index 20db721..0000000 --- a/server/templates/error.html +++ /dev/null @@ -1 +0,0 @@ -{# Provide a basic error page understandable to every user. #} \ No newline at end of file diff --git a/server/templates/index.html b/server/templates/index.html deleted file mode 100644 index edc09a8..0000000 --- a/server/templates/index.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'base.html' %} -{% block page %} -
-
-
-

- The Office Quotes -

-
-
-
-
-
-{% endblock page %} \ No newline at end of file diff --git a/server/templates/season.html b/server/templates/season.html deleted file mode 100644 index 763a899..0000000 --- a/server/templates/season.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends 'base.html' %} -{% block page %} -
-
-
-

- Season {{ season }} -

-
- -
-
-
-
-{% endblock page %} \ No newline at end of file