Skip to content

Commit

Permalink
Merge pull request #43 from zoripong/feat/#42
Browse files Browse the repository at this point in the history
Add the CORS configuration
  • Loading branch information
Yuri Han committed Apr 30, 2020
2 parents c72936c + 37824c6 commit fe82edf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/dev.conf.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[WEB]
DEBUG = true
SECRET_KEY = helloworld
CROSS_ORIGIN_URLS = ['http://localhost:1909']

[DATABASE]
URL = postgresql://localhost:5432/word-way
Expand Down
1 change: 1 addition & 0 deletions conf/prod.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[WEB]
DEBUG = false
SECRET_KEY = Rx_gFkK9pUYKY-hNoODBlA
CROSS_ORIGIN_URLS = ['http://localhost:1909']

[DATABASE]
URL = postgresql://localhost:5432/word-way
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
alembic >= 1.3.0, < 1.4.0
celery >= 4.4.2, < 4.5.0
Flask >= 1.1.1, < 1.2.0
Flask-Cors >= 3.0.8, < 3.1.0
gevent >= 1.4.0, < 1.5.0
nltk >= 3.4.5, < 3.5.0
psycopg2 >= 2.8.0, < 2.9.0
Expand Down
3 changes: 3 additions & 0 deletions word_way/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from flask import Flask
from flask_cors import CORS
from typeguard import typechecked

from word_way.api import api
Expand All @@ -19,4 +20,6 @@ def create_app(config_name: str) -> Flask:
config = load_config(config_name)
app.config.update(config['WEB'])
app.config['APP_CONFIG'] = config
CORS(app, origins=config['WEB']['CROSS_ORIGIN_URLS'])

return app

0 comments on commit fe82edf

Please sign in to comment.