add CORS rule for ANY origin

This commit is contained in:
Greg Gauthier 2024-06-22 22:29:19 +01:00
parent 4dc0bb94b4
commit 4e9cd5593a
2 changed files with 8 additions and 6 deletions

5
app.py
View File

@ -1,4 +1,5 @@
from flask import Flask from flask import Flask
from flask_cors import CORS
from flask_restx import Api, Resource from flask_restx import Api, Resource
from marshmallow import Schema, fields, validate from marshmallow import Schema, fields, validate
from models import dice_model, ability_model, hp_model, character_model from models import dice_model, ability_model, hp_model, character_model
@ -6,6 +7,8 @@ from mutations import Mutations
import random import random
app = Flask(__name__) app = Flask(__name__)
CORS(app)
app.config.SWAGGER_UI_JSONEDITOR = True app.config.SWAGGER_UI_JSONEDITOR = True
app.config['SWAGGER_UI_JSONEDITOR'] = True app.config['SWAGGER_UI_JSONEDITOR'] = True
api = Api(app, version='1.0', title='Gamma World Dice', description='Rolled Dice As A Service') api = Api(app, version='1.0', title='Gamma World Dice', description='Rolled Dice As A Service')
@ -273,7 +276,5 @@ def roll_mutations(conscore, intscore):
return mutations_table return mutations_table
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run()

View File

@ -2,3 +2,4 @@ Flask~=3.0.3
flask-restx~=1.3.0 flask-restx~=1.3.0
marshmallow~=3.21.3 marshmallow~=3.21.3
pandas~=2.2.2 pandas~=2.2.2
flask-cors~=4.0.1