Refactor into an app factory [2 of 2] (#322)

* Replace all `from nyaa import app` imports with `app = flask.current_app` (or `from flask import current_app as app` where possible)
* Add a separate config object for top-level and class statements as `nyaa.extensions.config`
Required because those codes don't have app context at the time of evaluation/execution.
* Remove `routes.py` file and register all blueprints in `nyaa/__init__.py`
* Refactor `nyaa/__init__.py` into an app factory
* Update tools
* Update tests (temporary, will be replaced)
This commit is contained in:
Kfir Hadas
2017-08-01 21:02:08 +03:00
committed by GitHub
parent 0181d6cb33
commit 87dd95f1e0
21 changed files with 140 additions and 96 deletions

View File

@@ -7,9 +7,11 @@ from werkzeug import secure_filename
from orderedset import OrderedSet
from nyaa import app, models, utils
from nyaa import models, utils
from nyaa.extensions import db
app = flask.current_app
@utils.cached_function
def get_category_id_map():