mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-11-05 09:15:53 +00:00
87dd95f1e0
* 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)
22 lines
439 B
Python
Executable file
22 lines
439 B
Python
Executable file
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import sys
|
|
|
|
from flask_script import Manager
|
|
from flask_migrate import Migrate, MigrateCommand
|
|
|
|
from nyaa import create_app
|
|
from nyaa.extensions import db
|
|
|
|
app = create_app('config')
|
|
migrate = Migrate(app, db)
|
|
|
|
manager = Manager(app)
|
|
manager.add_command("db", MigrateCommand)
|
|
|
|
if __name__ == "__main__":
|
|
# Patch sys.argv to default to 'db'
|
|
sys.argv.insert(1, 'db')
|
|
|
|
manager.run()
|