Skip to content

Commit

Permalink
Easing CORS on socketio to let localhost JS client connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Rmarieta committed Jan 23, 2024
1 parent 84aceb6 commit 72918ab
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions flask/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def create_app():

app = Flask(__name__)

cors = CORS(app, resources={
r"/*": {"origins": []}
})
cors = CORS(app, origins='*')

app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql+psycopg://{username}:{password}@{host}:{port}/{database}'.format(
username=os.environ['RDS_USERNAME'],
Expand All @@ -25,7 +23,7 @@ def create_app():
app.config['SECRET_KEY'] = os.environ['SECRET_KEY']

db.init_app(app)
socketio.init_app(app, message_queue=os.environ.get('REDIS_MESSAGE_QUEUE_URL'))
socketio.init_app(app, cors_allowed_origins='*', message_queue=os.environ.get('REDIS_MESSAGE_QUEUE_URL'))

# importing and registering routes with their url prefix
from .views.main import main_bp
Expand Down

0 comments on commit 72918ab

Please sign in to comment.