browser-go-api/app.py

26 lines
683 B
Python
Raw Normal View History

import os
from database import db, ma
from flask import Flask
from configuration.config import DevelopmentConfig
from flask_bcrypt import Bcrypt
from flask_cors import CORS
2019-10-07 17:09:49 +00:00
from flask_socketio import SocketIO
app = Flask(__name__)
bcrypt = Bcrypt(app)
app.config['CORS_HEADERS'] = 'Content-Type'
app.config.from_object(DevelopmentConfig)
2019-10-07 20:55:43 +00:00
socketio = SocketIO(app, cors_allowed_origins="http://localhost:3000")
# cors_allowed_origins="http://localhost:3000"
def create_app():
2019-10-07 17:19:48 +00:00
CORS(app, resources={
r"/api/*": {"origins": "http://localhost:3000"},
2019-10-07 20:55:43 +00:00
r"/auth/*": {"origins": "http://localhost:3000"},
2019-10-07 17:19:48 +00:00
})
db.init_app(app)
ma.init_app(app)
return app