from flask import Flask from flask_login import LoginManager from flask_restful import Api from flask_ckeditor import CKEditor from data import global_init from config import Config from flask_mail import Mail app = Flask(__name__) app.config.from_object(Config) ckeditor = CKEditor() ckeditor.init_app(app) mail = Mail(app) login_manager = LoginManager() login_manager.init_app(app) from app.blueprint_pages import blueprint from app import resources app.register_blueprint(blueprint) api = Api(app) api.add_resource(resources.CommentResource, '/api/comment', '/api/comment/<int:comment_id>') global_init('db/web.db') app.run(port=8080, host='127.0.0.1')
from flask import Flask from flask_login import LoginManager from flask_restful import Api from data import global_init from data.user import AnonymousUser from config import config config.setup() global_init() app = Flask(__name__, static_folder=config.STATIC_FOLDER) for key, value in config.APP_CONFIG.items(): app.config[key] = value app.jinja_options['extensions'].extend(config.JINJA_EXTENSIONS) login_manager = LoginManager() login_manager.init_app(app) login_manager.anonymous_user = AnonymousUser from . import errorhandlers from . import web_pages app.register_blueprint(web_pages.blueprint) api = Api(app) from .resources import UserResource, UsersResource, TeamResource, LeagueResource, LeaguesResource from .resources import GameResource, GamesResource, ProtocolResource api.add_resource(UserResource, '/api/user/<int:user_id>') api.add_resource(UsersResource, '/api/user') api.add_resource(TeamResource, '/api/team/<int:team_id>') api.add_resource(LeagueResource, '/api/league/<int:league_id>')
from flask import Flask from flask_login import LoginManager from flask_restful import Api from api.resources import users_resource, jobs_resource from data import global_init app = Flask(__name__) app.config['SECRET_KEY'] = 'key_secret_a_lot' api = Api(app) api.add_resource(users_resource.UserListResource, '/api/v2/users') api.add_resource(users_resource.UserResource, '/api/v2/users/<int:user_id>') api.add_resource(jobs_resource.JobResource, '/api/v2/jobs/<int:job_id>') api.add_resource(jobs_resource.JobListResource, '/api/v2/jobs') login_manager = LoginManager() login_manager.init_app(app) global_init("db/mars.db") from . import view if __name__ == '__main__': app.run(port=8080, host='127.0.0.1')