Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Stephan Porada 2019-07-10 14:36:33 +02:00
commit ef25ba7545
7 changed files with 59 additions and 20 deletions

View File

@ -1,3 +1,4 @@
from apscheduler.schedulers.background import BackgroundScheduler
from config import config
from flask import Flask
from flask_login import LoginManager
@ -6,11 +7,14 @@ from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
mail = Mail()
login_manager = LoginManager()
login_manager.login_view = 'auth.login'
mail = Mail()
background_scheduler = BackgroundScheduler()
def create_app(config_name):
app = Flask(__name__)
@ -27,4 +31,9 @@ def create_app(config_name):
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
from .scheduler import scheduler as scheduler_blueprint
app.register_blueprint(scheduler_blueprint, url_prefix='/scheduler')
background_scheduler.start()
return app

View File

@ -0,0 +1,5 @@
from flask import Blueprint
scheduler = Blueprint('scheduler', __name__)
from . import views

0
app/scheduler/forms.py Normal file
View File

21
app/scheduler/views.py Normal file
View File

@ -0,0 +1,21 @@
from flask import render_template
from . import scheduler
from flask_login import current_user, login_required
from .. import background_scheduler
import json
@scheduler.route('/')
@login_required
def scheduler():
job = {
'creator': current_user.id,
'files': ['file_1', 'file_2', 'file_3'],
'service': 'ocr',
'args': {
'lang': 'deu'
}
}
job = background_scheduler.add_job(print, trigger='date', args=[job])
print(job)
return render_template('scheduler/index.html.j2', title='Scheduler')

View File

@ -41,25 +41,21 @@
<li>
<div class="user-view">
<div class="background" style="background-color: #ee6e73;"></div>
<a href="#user"><img class="circle" src="{{ url_for('static', filename='images/account_circle.png') }}"></a>
<a href="#name">
<span class="white-text name">
{% if current_user.is_authenticated %}
{{ current_user.username }}
{% else %}
Unknown
{% endif %}
</span>
</a>
<a href="#email">
<span class="white-text email">
{% if current_user.is_authenticated %}
{{ current_user.email }}
{% else %}
Unknown
{% endif %}
</span>
</a>
<img class="circle" src="{{ url_for('static', filename='images/account_circle.png') }}">
<span class="white-text name">
{% if current_user.is_authenticated %}
{{ current_user.username }}
{% else %}
Unknown
{% endif %}
</span>
<span class="white-text email">
{% if current_user.is_authenticated %}
{{ current_user.email }}
{% else %}
Unknown
{% endif %}
</span>
</div>
</li>
<li><a href="{{ url_for('main.index') }}"><i class="material-icons">opacity</i>Opaque</a></li>

View File

@ -0,0 +1,7 @@
{% extends "base.html.j2" %}
{% block page_content %}
<div class="col s12">
</div>
{% endblock %}

View File

@ -1,3 +1,4 @@
APScheduler==3.6.0
Flask==1.0.3
Flask-Login==0.4.1
Flask-Mail==0.9.1