Create editor files

This commit is contained in:
Vivek Santayana 2022-06-18 09:39:31 +01:00
parent 69a0791a6d
commit bed186f6b5
6 changed files with 16 additions and 2 deletions

View File

View File

View File

@ -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')

View File

@ -1 +1 @@
from app.config import ProductionConfig as Config from app.config import DevelopmentConfig as Config

View File

@ -36,7 +36,7 @@ def create_app():
def _check_cookie_consent(): def _check_cookie_consent():
if request.cookies.get('cookie_consent'): if request.cookies.get('cookie_consent'):
return 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 return
flash(f'<strong>Cookie Consent</strong>: 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 <a href="{url_for("views._privacy")}">privacy policy</a>.', 'cookie_alert') flash(f'<strong>Cookie Consent</strong>: 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 <a href="{url_for("views._privacy")}">privacy policy</a>.', 'cookie_alert')
@ -51,11 +51,13 @@ def create_app():
from app.api.views import api from app.api.views import api
from app.quiz.views import quiz from app.quiz.views import quiz
from app.views import views from app.views import views
from app.editor.views import editor
app.register_blueprint(admin, url_prefix='/admin') app.register_blueprint(admin, url_prefix='/admin')
app.register_blueprint(api, url_prefix='/api') app.register_blueprint(api, url_prefix='/api')
app.register_blueprint(views) app.register_blueprint(views)
app.register_blueprint(quiz) 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}'): mkdir(f'./{data}')
if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions') if not path.isdir(f'./{data}/questions'): mkdir(f'./{data}/questions')