From 7fe1afb34809a1c22083ab38b55a1910edaca0df Mon Sep 17 00:00:00 2001 From: Vivek Santayana Date: Sat, 18 Jun 2022 09:39:31 +0100 Subject: [PATCH] Create editor files --- ref-test/app/editor/__init__.py | 0 ref-test/app/editor/static/editor.js | 0 ref-test/app/editor/static/js/editor.js | 0 ref-test/app/editor/templates/editor/index.html | 0 ref-test/app/editor/views.py | 12 ++++++++++++ ref-test/config.py | 2 +- ref-test/main.py | 4 +++- 7 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ref-test/app/editor/__init__.py create mode 100644 ref-test/app/editor/static/editor.js create mode 100644 ref-test/app/editor/static/js/editor.js create mode 100644 ref-test/app/editor/templates/editor/index.html create mode 100644 ref-test/app/editor/views.py diff --git a/ref-test/app/editor/__init__.py b/ref-test/app/editor/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/static/editor.js b/ref-test/app/editor/static/editor.js new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/static/js/editor.js b/ref-test/app/editor/static/js/editor.js new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/templates/editor/index.html b/ref-test/app/editor/templates/editor/index.html new file mode 100644 index 0000000..e69de29 diff --git a/ref-test/app/editor/views.py b/ref-test/app/editor/views.py new file mode 100644 index 0000000..fd729c4 --- /dev/null +++ b/ref-test/app/editor/views.py @@ -0,0 +1,12 @@ +from flask import Blueprint, render_template + +editor = Blueprint( + name='editor', + import_name=__name__, + template_folder='templates', + static_folder='static' +) + +@editor.route('/') +def _editor(): + return render_template('/editor/index.html') \ No newline at end of file diff --git a/ref-test/config.py b/ref-test/config.py index beea69e..38a499a 100644 --- a/ref-test/config.py +++ b/ref-test/config.py @@ -1 +1 @@ -from app.config import ProductionConfig as Config \ No newline at end of file +from app.config import DevelopmentConfig as Config \ No newline at end of file diff --git a/ref-test/main.py b/ref-test/main.py index aa270a9..e97c9e1 100644 --- a/ref-test/main.py +++ b/ref-test/main.py @@ -36,7 +36,7 @@ def create_app(): def _check_cookie_consent(): if request.cookies.get('cookie_consent'): return - if any([ request.path.startswith(x) for x in [ '/admin/static/', '/static/', '/cookies/' ] ]): + if any([ request.path.startswith(x) for x in [ '/admin/static/', '/root/', '/quiz/static', '/admin/editor/static/', '/cookies/' ] ]): return flash(f'Cookie Consent: This web site only stores minimal, functional cookies. It does not store any tracking information. By using this site, you consent to this use of cookies. For more information, see our privacy policy.', 'cookie_alert') @@ -51,11 +51,13 @@ def create_app(): from app.api.views import api from app.quiz.views import quiz from app.views import views + from app.editor.views import editor app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(api, url_prefix='/api') app.register_blueprint(views) app.register_blueprint(quiz) + app.register_blueprint(editor, url_prefix='/admin/editor') if not path.isdir(f'./{data}'): mkdir(f'./{data}') if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions')