from flask import Flask from flask_cors import CORS from flask_restx import Api from config import BASE_DIR, DATA_DIR, MONSTERS_JSON_PATH app = Flask(__name__) CORS(app) restx_api = Api(app, version='1.0', title='Gamma World Dice', description='Rolled Dice As A Service') app.config['DEBUG'] = True app.config.SWAGGER_UI_JSONEDITOR = True app.config['SWAGGER_UI_JSONEDITOR'] = True app.config['BASE_DIR'] = BASE_DIR app.config['DATA_DIR'] = DATA_DIR app.config['MONSTERS_JSON_PATH'] = MONSTERS_JSON_PATH def init(): from app.routes import coinflip, roll_chance, roll_dice, table_views, encounter, character, \ ability_check, mental_attack, physical_attack, get_monster # root namespace restx_api.add_namespace(coinflip.namespace) # dice namespace restx_api.add_namespace(roll_dice.namespace) restx_api.add_namespace(roll_chance.namespace) # rules namespace restx_api.add_namespace(table_views.namespace) restx_api.add_namespace(character.namespace) restx_api.add_namespace(get_monster.namespace) # gameplay namespace restx_api.add_namespace(encounter.namespace) restx_api.add_namespace(ability_check.namespace) restx_api.add_namespace(mental_attack.namespace) restx_api.add_namespace(physical_attack.namespace) init()