From eeb5a280b3b655979b57ba0b095ce90272e9d025 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Mon, 30 Sep 2024 13:30:13 +0200
Subject: [PATCH] move blueprints in dedicated folder
---
app/__init__.py | 44 +++++++------------
app/{ => blueprints}/admin/__init__.py | 0
app/{ => blueprints}/admin/events.py | 0
app/{ => blueprints}/admin/forms.py | 0
app/{ => blueprints}/admin/json_routes.py | 0
app/{ => blueprints}/admin/routes.py | 2 +-
app/{ => blueprints}/api/__init__.py | 0
app/{ => blueprints}/api/auth.py | 0
app/{ => blueprints}/api/jobs.py | 0
app/{ => blueprints}/api/schemas.py | 2 +-
app/{ => blueprints}/api/tokens.py | 0
app/{ => blueprints}/api/users.py | 0
app/{ => blueprints}/auth/__init__.py | 0
app/{ => blueprints}/auth/forms.py | 0
app/{ => blueprints}/auth/routes.py | 0
.../contributions/__init__.py | 0
app/{ => blueprints}/contributions/forms.py | 0
app/{ => blueprints}/contributions/routes.py | 0
.../spacy_nlp_pipeline_models/__init__.py | 0
.../spacy_nlp_pipeline_models/forms.py | 2 +-
.../spacy_nlp_pipeline_models/json_routes.py | 0
.../spacy_nlp_pipeline_models/routes.py | 0
.../tesseract_ocr_pipeline_models/__init__.py | 0
.../tesseract_ocr_pipeline_models/forms.py | 4 +-
.../json_routes.py | 0
.../tesseract_ocr_pipeline_models/routes.py | 0
.../__init__.py | 0
.../transkribus_htr_pipeline_models/routes.py | 0
app/{ => blueprints}/corpora/__init__.py | 0
app/{ => blueprints}/corpora/cli.py | 0
.../corpora/cqi_over_sio/__init__.py | 0
.../corpora/cqi_over_sio/extensions.py | 0
.../corpora/cqi_over_sio/utils.py | 0
app/{ => blueprints}/corpora/decorators.py | 0
app/{ => blueprints}/corpora/events.py | 0
.../corpora/files/__init__.py | 0
app/{ => blueprints}/corpora/files/forms.py | 0
.../corpora/files/json_routes.py | 0
app/{ => blueprints}/corpora/files/routes.py | 0
.../corpora/followers/__init__.py | 0
.../corpora/followers/json_routes.py | 0
app/{ => blueprints}/corpora/forms.py | 0
app/{ => blueprints}/corpora/json_routes.py | 0
app/{ => blueprints}/corpora/routes.py | 0
app/{ => blueprints}/errors/__init__.py | 0
app/{ => blueprints}/errors/handlers.py | 0
app/blueprints/jobs/__init__.py | 18 ++++++++
app/{ => blueprints}/jobs/events.py | 0
app/{ => blueprints}/jobs/json_routes.py | 0
app/{ => blueprints}/jobs/routes.py | 0
app/{ => blueprints}/main/__init__.py | 0
app/{ => blueprints}/main/cli.py | 0
app/{ => blueprints}/main/routes.py | 2 +-
app/{ => blueprints}/services/__init__.py | 0
app/{ => blueprints}/services/forms.py | 0
app/{ => blueprints}/services/routes.py | 0
app/{ => blueprints}/services/services.yml | 0
app/{ => blueprints}/settings/__init__.py | 0
app/{ => blueprints}/settings/routes.py | 2 +-
app/{ => blueprints}/users/__init__.py | 0
app/{ => blueprints}/users/cli.py | 0
app/{ => blueprints}/users/events.py | 0
app/{ => blueprints}/users/json_routes.py | 0
app/{ => blueprints}/users/nevents.py | 0
app/{ => blueprints}/users/routes.py | 0
.../users/settings/__init__.py | 0
app/{ => blueprints}/users/settings/forms.py | 0
.../users/settings/json_routes.py | 0
app/{ => blueprints}/users/settings/routes.py | 0
app/{ => blueprints}/workshops/__init__.py | 0
app/{ => blueprints}/workshops/routes.py | 0
app/jobs/__init__.py | 20 +--------
app/{tasks => jobs}/handle_corpora.py | 2 +-
app/{tasks => jobs}/handle_jobs.py | 2 +-
app/tasks/__init__.py | 2 -
75 files changed, 44 insertions(+), 58 deletions(-)
rename app/{ => blueprints}/admin/__init__.py (100%)
rename app/{ => blueprints}/admin/events.py (100%)
rename app/{ => blueprints}/admin/forms.py (100%)
rename app/{ => blueprints}/admin/json_routes.py (100%)
rename app/{ => blueprints}/admin/routes.py (99%)
rename app/{ => blueprints}/api/__init__.py (100%)
rename app/{ => blueprints}/api/auth.py (100%)
rename app/{ => blueprints}/api/jobs.py (100%)
rename app/{ => blueprints}/api/schemas.py (99%)
rename app/{ => blueprints}/api/tokens.py (100%)
rename app/{ => blueprints}/api/users.py (100%)
rename app/{ => blueprints}/auth/__init__.py (100%)
rename app/{ => blueprints}/auth/forms.py (100%)
rename app/{ => blueprints}/auth/routes.py (100%)
rename app/{ => blueprints}/contributions/__init__.py (100%)
rename app/{ => blueprints}/contributions/forms.py (100%)
rename app/{ => blueprints}/contributions/routes.py (100%)
rename app/{ => blueprints}/contributions/spacy_nlp_pipeline_models/__init__.py (100%)
rename app/{ => blueprints}/contributions/spacy_nlp_pipeline_models/forms.py (97%)
rename app/{ => blueprints}/contributions/spacy_nlp_pipeline_models/json_routes.py (100%)
rename app/{ => blueprints}/contributions/spacy_nlp_pipeline_models/routes.py (100%)
rename app/{ => blueprints}/contributions/tesseract_ocr_pipeline_models/__init__.py (100%)
rename app/{ => blueprints}/contributions/tesseract_ocr_pipeline_models/forms.py (97%)
rename app/{ => blueprints}/contributions/tesseract_ocr_pipeline_models/json_routes.py (100%)
rename app/{ => blueprints}/contributions/tesseract_ocr_pipeline_models/routes.py (100%)
rename app/{ => blueprints}/contributions/transkribus_htr_pipeline_models/__init__.py (100%)
rename app/{ => blueprints}/contributions/transkribus_htr_pipeline_models/routes.py (100%)
rename app/{ => blueprints}/corpora/__init__.py (100%)
rename app/{ => blueprints}/corpora/cli.py (100%)
rename app/{ => blueprints}/corpora/cqi_over_sio/__init__.py (100%)
rename app/{ => blueprints}/corpora/cqi_over_sio/extensions.py (100%)
rename app/{ => blueprints}/corpora/cqi_over_sio/utils.py (100%)
rename app/{ => blueprints}/corpora/decorators.py (100%)
rename app/{ => blueprints}/corpora/events.py (100%)
rename app/{ => blueprints}/corpora/files/__init__.py (100%)
rename app/{ => blueprints}/corpora/files/forms.py (100%)
rename app/{ => blueprints}/corpora/files/json_routes.py (100%)
rename app/{ => blueprints}/corpora/files/routes.py (100%)
rename app/{ => blueprints}/corpora/followers/__init__.py (100%)
rename app/{ => blueprints}/corpora/followers/json_routes.py (100%)
rename app/{ => blueprints}/corpora/forms.py (100%)
rename app/{ => blueprints}/corpora/json_routes.py (100%)
rename app/{ => blueprints}/corpora/routes.py (100%)
rename app/{ => blueprints}/errors/__init__.py (100%)
rename app/{ => blueprints}/errors/handlers.py (100%)
create mode 100644 app/blueprints/jobs/__init__.py
rename app/{ => blueprints}/jobs/events.py (100%)
rename app/{ => blueprints}/jobs/json_routes.py (100%)
rename app/{ => blueprints}/jobs/routes.py (100%)
rename app/{ => blueprints}/main/__init__.py (100%)
rename app/{ => blueprints}/main/cli.py (100%)
rename app/{ => blueprints}/main/routes.py (97%)
rename app/{ => blueprints}/services/__init__.py (100%)
rename app/{ => blueprints}/services/forms.py (100%)
rename app/{ => blueprints}/services/routes.py (100%)
rename app/{ => blueprints}/services/services.yml (100%)
rename app/{ => blueprints}/settings/__init__.py (100%)
rename app/{ => blueprints}/settings/routes.py (77%)
rename app/{ => blueprints}/users/__init__.py (100%)
rename app/{ => blueprints}/users/cli.py (100%)
rename app/{ => blueprints}/users/events.py (100%)
rename app/{ => blueprints}/users/json_routes.py (100%)
rename app/{ => blueprints}/users/nevents.py (100%)
rename app/{ => blueprints}/users/routes.py (100%)
rename app/{ => blueprints}/users/settings/__init__.py (100%)
rename app/{ => blueprints}/users/settings/forms.py (100%)
rename app/{ => blueprints}/users/settings/json_routes.py (100%)
rename app/{ => blueprints}/users/settings/routes.py (100%)
rename app/{ => blueprints}/workshops/__init__.py (100%)
rename app/{ => blueprints}/workshops/routes.py (100%)
rename app/{tasks => jobs}/handle_corpora.py (99%)
rename app/{tasks => jobs}/handle_jobs.py (99%)
delete mode 100644 app/tasks/__init__.py
diff --git a/app/__init__.py b/app/__init__.py
index afe0dca5..c3e8a0c2 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -92,45 +92,45 @@ def create_app(config: Config = Config) -> Flask:
# endregion Extensions
# region Blueprints
- from .admin import bp as admin_blueprint
+ from .blueprints.admin import bp as admin_blueprint
app.register_blueprint(admin_blueprint, url_prefix='/admin')
- from .api import bp as api_blueprint
+ from .blueprints.api import bp as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api')
- from .auth import bp as auth_blueprint
+ from .blueprints.auth import bp as auth_blueprint
app.register_blueprint(auth_blueprint)
- from .contributions import bp as contributions_blueprint
+ from .blueprints.contributions import bp as contributions_blueprint
app.register_blueprint(contributions_blueprint, url_prefix='/contributions')
- from .corpora import bp as corpora_blueprint
+ from .blueprints.corpora import bp as corpora_blueprint
app.register_blueprint(corpora_blueprint, cli_group='corpus', url_prefix='/corpora')
- from .errors import bp as errors_bp
+ from .blueprints.errors import bp as errors_bp
app.register_blueprint(errors_bp)
- from .jobs import bp as jobs_blueprint
+ from .blueprints.jobs import bp as jobs_blueprint
app.register_blueprint(jobs_blueprint, url_prefix='/jobs')
- from .main import bp as main_blueprint
+ from .blueprints.main import bp as main_blueprint
app.register_blueprint(main_blueprint, cli_group=None)
- from .services import bp as services_blueprint
+ from .blueprints.services import bp as services_blueprint
app.register_blueprint(services_blueprint, url_prefix='/services')
- from .settings import bp as settings_blueprint
+ from .blueprints.settings import bp as settings_blueprint
app.register_blueprint(settings_blueprint, url_prefix='/settings')
- from .users import bp as users_blueprint
+ from .blueprints.users import bp as users_blueprint
app.register_blueprint(users_blueprint, cli_group='user', url_prefix='/users')
- from .workshops import bp as workshops_blueprint
+ from .blueprints.workshops import bp as workshops_blueprint
app.register_blueprint(workshops_blueprint, url_prefix='/workshops')
# endregion Blueprints
# region SocketIO Namespaces
- from .corpora.cqi_over_sio import CQiOverSocketIO
+ from .blueprints.corpora.cqi_over_sio import CQiOverSocketIO
socketio.on_namespace(CQiOverSocketIO('/cqi_over_sio'))
# endregion SocketIO Namespaces
@@ -141,25 +141,11 @@ def create_app(config: Config = Config) -> Flask:
# region Add scheduler jobs
if app.config['NOPAQUE_IS_PRIMARY_INSTANCE']:
- from .tasks import handle_corpora
+ from .jobs import handle_corpora
scheduler.add_job('handle_corpora', handle_corpora, seconds=3, trigger='interval')
- from .tasks import handle_jobs
+ from .jobs import handle_jobs
scheduler.add_job('handle_jobs', handle_jobs, seconds=3, trigger='interval')
# endregion Add scheduler jobs
return app
-
-
-# def _add_admin_views():
-# from flask_admin.contrib.sqla import ModelView
-# from . import models
-
-# for v in models.__dict__.values():
-# # Check if v is a class
-# if not isinstance(v, type):
-# continue
-# # Check if v is a subclass of db.Model
-# if not issubclass(v, db.Model):
-# continue
-# admin.add_view(ModelView(v, db.session, category='Database'))
diff --git a/app/admin/__init__.py b/app/blueprints/admin/__init__.py
similarity index 100%
rename from app/admin/__init__.py
rename to app/blueprints/admin/__init__.py
diff --git a/app/admin/events.py b/app/blueprints/admin/events.py
similarity index 100%
rename from app/admin/events.py
rename to app/blueprints/admin/events.py
diff --git a/app/admin/forms.py b/app/blueprints/admin/forms.py
similarity index 100%
rename from app/admin/forms.py
rename to app/blueprints/admin/forms.py
diff --git a/app/admin/json_routes.py b/app/blueprints/admin/json_routes.py
similarity index 100%
rename from app/admin/json_routes.py
rename to app/blueprints/admin/json_routes.py
diff --git a/app/admin/routes.py b/app/blueprints/admin/routes.py
similarity index 99%
rename from app/admin/routes.py
rename to app/blueprints/admin/routes.py
index 49938b48..f13a8d7c 100644
--- a/app/admin/routes.py
+++ b/app/blueprints/admin/routes.py
@@ -1,7 +1,7 @@
from flask import abort, flash, redirect, render_template, url_for
from app import db, hashids
from app.models import Avatar, Corpus, Role, User
-from app.users.settings.forms import (
+from app.blueprints.users.settings.forms import (
UpdateAvatarForm,
UpdatePasswordForm,
UpdateNotificationsForm,
diff --git a/app/api/__init__.py b/app/blueprints/api/__init__.py
similarity index 100%
rename from app/api/__init__.py
rename to app/blueprints/api/__init__.py
diff --git a/app/api/auth.py b/app/blueprints/api/auth.py
similarity index 100%
rename from app/api/auth.py
rename to app/blueprints/api/auth.py
diff --git a/app/api/jobs.py b/app/blueprints/api/jobs.py
similarity index 100%
rename from app/api/jobs.py
rename to app/blueprints/api/jobs.py
diff --git a/app/api/schemas.py b/app/blueprints/api/schemas.py
similarity index 99%
rename from app/api/schemas.py
rename to app/blueprints/api/schemas.py
index 74f4cb2a..349088fe 100644
--- a/app/api/schemas.py
+++ b/app/blueprints/api/schemas.py
@@ -10,7 +10,7 @@ from app.models import (
User,
UserSettingJobStatusMailNotificationLevel
)
-from app.services import SERVICES
+from app.blueprints.services import SERVICES
diff --git a/app/api/tokens.py b/app/blueprints/api/tokens.py
similarity index 100%
rename from app/api/tokens.py
rename to app/blueprints/api/tokens.py
diff --git a/app/api/users.py b/app/blueprints/api/users.py
similarity index 100%
rename from app/api/users.py
rename to app/blueprints/api/users.py
diff --git a/app/auth/__init__.py b/app/blueprints/auth/__init__.py
similarity index 100%
rename from app/auth/__init__.py
rename to app/blueprints/auth/__init__.py
diff --git a/app/auth/forms.py b/app/blueprints/auth/forms.py
similarity index 100%
rename from app/auth/forms.py
rename to app/blueprints/auth/forms.py
diff --git a/app/auth/routes.py b/app/blueprints/auth/routes.py
similarity index 100%
rename from app/auth/routes.py
rename to app/blueprints/auth/routes.py
diff --git a/app/contributions/__init__.py b/app/blueprints/contributions/__init__.py
similarity index 100%
rename from app/contributions/__init__.py
rename to app/blueprints/contributions/__init__.py
diff --git a/app/contributions/forms.py b/app/blueprints/contributions/forms.py
similarity index 100%
rename from app/contributions/forms.py
rename to app/blueprints/contributions/forms.py
diff --git a/app/contributions/routes.py b/app/blueprints/contributions/routes.py
similarity index 100%
rename from app/contributions/routes.py
rename to app/blueprints/contributions/routes.py
diff --git a/app/contributions/spacy_nlp_pipeline_models/__init__.py b/app/blueprints/contributions/spacy_nlp_pipeline_models/__init__.py
similarity index 100%
rename from app/contributions/spacy_nlp_pipeline_models/__init__.py
rename to app/blueprints/contributions/spacy_nlp_pipeline_models/__init__.py
diff --git a/app/contributions/spacy_nlp_pipeline_models/forms.py b/app/blueprints/contributions/spacy_nlp_pipeline_models/forms.py
similarity index 97%
rename from app/contributions/spacy_nlp_pipeline_models/forms.py
rename to app/blueprints/contributions/spacy_nlp_pipeline_models/forms.py
index d05e5681..52ac1e58 100644
--- a/app/contributions/spacy_nlp_pipeline_models/forms.py
+++ b/app/blueprints/contributions/spacy_nlp_pipeline_models/forms.py
@@ -1,7 +1,7 @@
from flask_wtf.file import FileField, FileRequired
from wtforms import StringField, ValidationError
from wtforms.validators import InputRequired, Length
-from app.services import SERVICES
+from app.blueprints.services import SERVICES
from ..forms import ContributionBaseForm, UpdateContributionBaseForm
diff --git a/app/contributions/spacy_nlp_pipeline_models/json_routes.py b/app/blueprints/contributions/spacy_nlp_pipeline_models/json_routes.py
similarity index 100%
rename from app/contributions/spacy_nlp_pipeline_models/json_routes.py
rename to app/blueprints/contributions/spacy_nlp_pipeline_models/json_routes.py
diff --git a/app/contributions/spacy_nlp_pipeline_models/routes.py b/app/blueprints/contributions/spacy_nlp_pipeline_models/routes.py
similarity index 100%
rename from app/contributions/spacy_nlp_pipeline_models/routes.py
rename to app/blueprints/contributions/spacy_nlp_pipeline_models/routes.py
diff --git a/app/contributions/tesseract_ocr_pipeline_models/__init__.py b/app/blueprints/contributions/tesseract_ocr_pipeline_models/__init__.py
similarity index 100%
rename from app/contributions/tesseract_ocr_pipeline_models/__init__.py
rename to app/blueprints/contributions/tesseract_ocr_pipeline_models/__init__.py
diff --git a/app/contributions/tesseract_ocr_pipeline_models/forms.py b/app/blueprints/contributions/tesseract_ocr_pipeline_models/forms.py
similarity index 97%
rename from app/contributions/tesseract_ocr_pipeline_models/forms.py
rename to app/blueprints/contributions/tesseract_ocr_pipeline_models/forms.py
index 9a5979dd..d9d6b59f 100644
--- a/app/contributions/tesseract_ocr_pipeline_models/forms.py
+++ b/app/blueprints/contributions/tesseract_ocr_pipeline_models/forms.py
@@ -1,6 +1,6 @@
from flask_wtf.file import FileField, FileRequired
from wtforms import ValidationError
-from app.services import SERVICES
+from app.blueprints.services import SERVICES
from ..forms import ContributionBaseForm, UpdateContributionBaseForm
@@ -9,7 +9,7 @@ class CreateTesseractOCRPipelineModelForm(ContributionBaseForm):
'File',
validators=[FileRequired()]
)
-
+
def validate_tesseract_model_file(self, field):
if not field.data.filename.lower().endswith('.traineddata'):
raise ValidationError('traineddata files only!')
diff --git a/app/contributions/tesseract_ocr_pipeline_models/json_routes.py b/app/blueprints/contributions/tesseract_ocr_pipeline_models/json_routes.py
similarity index 100%
rename from app/contributions/tesseract_ocr_pipeline_models/json_routes.py
rename to app/blueprints/contributions/tesseract_ocr_pipeline_models/json_routes.py
diff --git a/app/contributions/tesseract_ocr_pipeline_models/routes.py b/app/blueprints/contributions/tesseract_ocr_pipeline_models/routes.py
similarity index 100%
rename from app/contributions/tesseract_ocr_pipeline_models/routes.py
rename to app/blueprints/contributions/tesseract_ocr_pipeline_models/routes.py
diff --git a/app/contributions/transkribus_htr_pipeline_models/__init__.py b/app/blueprints/contributions/transkribus_htr_pipeline_models/__init__.py
similarity index 100%
rename from app/contributions/transkribus_htr_pipeline_models/__init__.py
rename to app/blueprints/contributions/transkribus_htr_pipeline_models/__init__.py
diff --git a/app/contributions/transkribus_htr_pipeline_models/routes.py b/app/blueprints/contributions/transkribus_htr_pipeline_models/routes.py
similarity index 100%
rename from app/contributions/transkribus_htr_pipeline_models/routes.py
rename to app/blueprints/contributions/transkribus_htr_pipeline_models/routes.py
diff --git a/app/corpora/__init__.py b/app/blueprints/corpora/__init__.py
similarity index 100%
rename from app/corpora/__init__.py
rename to app/blueprints/corpora/__init__.py
diff --git a/app/corpora/cli.py b/app/blueprints/corpora/cli.py
similarity index 100%
rename from app/corpora/cli.py
rename to app/blueprints/corpora/cli.py
diff --git a/app/corpora/cqi_over_sio/__init__.py b/app/blueprints/corpora/cqi_over_sio/__init__.py
similarity index 100%
rename from app/corpora/cqi_over_sio/__init__.py
rename to app/blueprints/corpora/cqi_over_sio/__init__.py
diff --git a/app/corpora/cqi_over_sio/extensions.py b/app/blueprints/corpora/cqi_over_sio/extensions.py
similarity index 100%
rename from app/corpora/cqi_over_sio/extensions.py
rename to app/blueprints/corpora/cqi_over_sio/extensions.py
diff --git a/app/corpora/cqi_over_sio/utils.py b/app/blueprints/corpora/cqi_over_sio/utils.py
similarity index 100%
rename from app/corpora/cqi_over_sio/utils.py
rename to app/blueprints/corpora/cqi_over_sio/utils.py
diff --git a/app/corpora/decorators.py b/app/blueprints/corpora/decorators.py
similarity index 100%
rename from app/corpora/decorators.py
rename to app/blueprints/corpora/decorators.py
diff --git a/app/corpora/events.py b/app/blueprints/corpora/events.py
similarity index 100%
rename from app/corpora/events.py
rename to app/blueprints/corpora/events.py
diff --git a/app/corpora/files/__init__.py b/app/blueprints/corpora/files/__init__.py
similarity index 100%
rename from app/corpora/files/__init__.py
rename to app/blueprints/corpora/files/__init__.py
diff --git a/app/corpora/files/forms.py b/app/blueprints/corpora/files/forms.py
similarity index 100%
rename from app/corpora/files/forms.py
rename to app/blueprints/corpora/files/forms.py
diff --git a/app/corpora/files/json_routes.py b/app/blueprints/corpora/files/json_routes.py
similarity index 100%
rename from app/corpora/files/json_routes.py
rename to app/blueprints/corpora/files/json_routes.py
diff --git a/app/corpora/files/routes.py b/app/blueprints/corpora/files/routes.py
similarity index 100%
rename from app/corpora/files/routes.py
rename to app/blueprints/corpora/files/routes.py
diff --git a/app/corpora/followers/__init__.py b/app/blueprints/corpora/followers/__init__.py
similarity index 100%
rename from app/corpora/followers/__init__.py
rename to app/blueprints/corpora/followers/__init__.py
diff --git a/app/corpora/followers/json_routes.py b/app/blueprints/corpora/followers/json_routes.py
similarity index 100%
rename from app/corpora/followers/json_routes.py
rename to app/blueprints/corpora/followers/json_routes.py
diff --git a/app/corpora/forms.py b/app/blueprints/corpora/forms.py
similarity index 100%
rename from app/corpora/forms.py
rename to app/blueprints/corpora/forms.py
diff --git a/app/corpora/json_routes.py b/app/blueprints/corpora/json_routes.py
similarity index 100%
rename from app/corpora/json_routes.py
rename to app/blueprints/corpora/json_routes.py
diff --git a/app/corpora/routes.py b/app/blueprints/corpora/routes.py
similarity index 100%
rename from app/corpora/routes.py
rename to app/blueprints/corpora/routes.py
diff --git a/app/errors/__init__.py b/app/blueprints/errors/__init__.py
similarity index 100%
rename from app/errors/__init__.py
rename to app/blueprints/errors/__init__.py
diff --git a/app/errors/handlers.py b/app/blueprints/errors/handlers.py
similarity index 100%
rename from app/errors/handlers.py
rename to app/blueprints/errors/handlers.py
diff --git a/app/blueprints/jobs/__init__.py b/app/blueprints/jobs/__init__.py
new file mode 100644
index 00000000..1350e7e1
--- /dev/null
+++ b/app/blueprints/jobs/__init__.py
@@ -0,0 +1,18 @@
+from flask import Blueprint
+from flask_login import login_required
+
+
+bp = Blueprint('jobs', __name__)
+
+
+@bp.before_request
+@login_required
+def before_request():
+ '''
+ Ensures that the routes in this package can only be visited by users that
+ are logged in.
+ '''
+ pass
+
+
+from . import routes, json_routes
diff --git a/app/jobs/events.py b/app/blueprints/jobs/events.py
similarity index 100%
rename from app/jobs/events.py
rename to app/blueprints/jobs/events.py
diff --git a/app/jobs/json_routes.py b/app/blueprints/jobs/json_routes.py
similarity index 100%
rename from app/jobs/json_routes.py
rename to app/blueprints/jobs/json_routes.py
diff --git a/app/jobs/routes.py b/app/blueprints/jobs/routes.py
similarity index 100%
rename from app/jobs/routes.py
rename to app/blueprints/jobs/routes.py
diff --git a/app/main/__init__.py b/app/blueprints/main/__init__.py
similarity index 100%
rename from app/main/__init__.py
rename to app/blueprints/main/__init__.py
diff --git a/app/main/cli.py b/app/blueprints/main/cli.py
similarity index 100%
rename from app/main/cli.py
rename to app/blueprints/main/cli.py
diff --git a/app/main/routes.py b/app/blueprints/main/routes.py
similarity index 97%
rename from app/main/routes.py
rename to app/blueprints/main/routes.py
index 6a4365b1..9fb91806 100644
--- a/app/main/routes.py
+++ b/app/blueprints/main/routes.py
@@ -1,6 +1,6 @@
from flask import flash, redirect, render_template, url_for
from flask_login import current_user, login_required, login_user
-from app.auth.forms import LoginForm
+from app.blueprints.auth.forms import LoginForm
from app.models import Corpus, User
from . import bp
diff --git a/app/services/__init__.py b/app/blueprints/services/__init__.py
similarity index 100%
rename from app/services/__init__.py
rename to app/blueprints/services/__init__.py
diff --git a/app/services/forms.py b/app/blueprints/services/forms.py
similarity index 100%
rename from app/services/forms.py
rename to app/blueprints/services/forms.py
diff --git a/app/services/routes.py b/app/blueprints/services/routes.py
similarity index 100%
rename from app/services/routes.py
rename to app/blueprints/services/routes.py
diff --git a/app/services/services.yml b/app/blueprints/services/services.yml
similarity index 100%
rename from app/services/services.yml
rename to app/blueprints/services/services.yml
diff --git a/app/settings/__init__.py b/app/blueprints/settings/__init__.py
similarity index 100%
rename from app/settings/__init__.py
rename to app/blueprints/settings/__init__.py
diff --git a/app/settings/routes.py b/app/blueprints/settings/routes.py
similarity index 77%
rename from app/settings/routes.py
rename to app/blueprints/settings/routes.py
index 35d9fbe0..9bc1c99e 100644
--- a/app/settings/routes.py
+++ b/app/blueprints/settings/routes.py
@@ -1,6 +1,6 @@
from flask import g, url_for
from flask_login import current_user
-from app.users.settings.routes import settings as settings_route
+from app.blueprints.users.settings.routes import settings as settings_route
from . import bp
diff --git a/app/users/__init__.py b/app/blueprints/users/__init__.py
similarity index 100%
rename from app/users/__init__.py
rename to app/blueprints/users/__init__.py
diff --git a/app/users/cli.py b/app/blueprints/users/cli.py
similarity index 100%
rename from app/users/cli.py
rename to app/blueprints/users/cli.py
diff --git a/app/users/events.py b/app/blueprints/users/events.py
similarity index 100%
rename from app/users/events.py
rename to app/blueprints/users/events.py
diff --git a/app/users/json_routes.py b/app/blueprints/users/json_routes.py
similarity index 100%
rename from app/users/json_routes.py
rename to app/blueprints/users/json_routes.py
diff --git a/app/users/nevents.py b/app/blueprints/users/nevents.py
similarity index 100%
rename from app/users/nevents.py
rename to app/blueprints/users/nevents.py
diff --git a/app/users/routes.py b/app/blueprints/users/routes.py
similarity index 100%
rename from app/users/routes.py
rename to app/blueprints/users/routes.py
diff --git a/app/users/settings/__init__.py b/app/blueprints/users/settings/__init__.py
similarity index 100%
rename from app/users/settings/__init__.py
rename to app/blueprints/users/settings/__init__.py
diff --git a/app/users/settings/forms.py b/app/blueprints/users/settings/forms.py
similarity index 100%
rename from app/users/settings/forms.py
rename to app/blueprints/users/settings/forms.py
diff --git a/app/users/settings/json_routes.py b/app/blueprints/users/settings/json_routes.py
similarity index 100%
rename from app/users/settings/json_routes.py
rename to app/blueprints/users/settings/json_routes.py
diff --git a/app/users/settings/routes.py b/app/blueprints/users/settings/routes.py
similarity index 100%
rename from app/users/settings/routes.py
rename to app/blueprints/users/settings/routes.py
diff --git a/app/workshops/__init__.py b/app/blueprints/workshops/__init__.py
similarity index 100%
rename from app/workshops/__init__.py
rename to app/blueprints/workshops/__init__.py
diff --git a/app/workshops/routes.py b/app/blueprints/workshops/routes.py
similarity index 100%
rename from app/workshops/routes.py
rename to app/blueprints/workshops/routes.py
diff --git a/app/jobs/__init__.py b/app/jobs/__init__.py
index 1350e7e1..26b42130 100644
--- a/app/jobs/__init__.py
+++ b/app/jobs/__init__.py
@@ -1,18 +1,2 @@
-from flask import Blueprint
-from flask_login import login_required
-
-
-bp = Blueprint('jobs', __name__)
-
-
-@bp.before_request
-@login_required
-def before_request():
- '''
- Ensures that the routes in this package can only be visited by users that
- are logged in.
- '''
- pass
-
-
-from . import routes, json_routes
+from .handle_corpora import job as handle_corpora
+from .handle_jobs import job as handle_jobs
diff --git a/app/tasks/handle_corpora.py b/app/jobs/handle_corpora.py
similarity index 99%
rename from app/tasks/handle_corpora.py
rename to app/jobs/handle_corpora.py
index e61c4741..8564d047 100644
--- a/app/tasks/handle_corpora.py
+++ b/app/jobs/handle_corpora.py
@@ -6,7 +6,7 @@ import os
import shutil
-def task():
+def job():
with scheduler.app.app_context():
_handle_corpora()
diff --git a/app/tasks/handle_jobs.py b/app/jobs/handle_jobs.py
similarity index 99%
rename from app/tasks/handle_jobs.py
rename to app/jobs/handle_jobs.py
index 6b818080..333ff8b5 100644
--- a/app/tasks/handle_jobs.py
+++ b/app/jobs/handle_jobs.py
@@ -15,7 +15,7 @@ import os
import shutil
-def task():
+def job():
with scheduler.app.app_context():
_handle_jobs()
diff --git a/app/tasks/__init__.py b/app/tasks/__init__.py
deleted file mode 100644
index 3112406f..00000000
--- a/app/tasks/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .handle_corpora import task as handle_corpora
-from .handle_jobs import task as handle_jobs