Skip to content

Commit

Permalink
Merge pull request #286 from jacebrowning/enable-cors
Browse files Browse the repository at this point in the history
Enable CORS
  • Loading branch information
jacebrowning committed Nov 10, 2016
2 parents 518a9d2 + 8b35abf commit 822884d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions memegen/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from flask_api import FlaskAPI
from flask_api.exceptions import APIException, NotFound

from . import extensions
from . import services
from . import stores
from . import routes
Expand Down Expand Up @@ -38,6 +39,7 @@ def create_app(config):

configure_logging(app)

register_extensions(app)
register_services(app)
register_blueprints(app)

Expand All @@ -55,6 +57,10 @@ def configure_logging(app):
logging.getLogger('PIL').setLevel(logging.INFO)


def register_extensions(app):
extensions.cors.init_app(app, methods=['GET', 'OPTIONS'], allow_headers='*')


def register_services(app):
exceptions = services.Exceptions(
TemplateNotFound,
Expand Down
3 changes: 3 additions & 0 deletions memegen/extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from flask_cors import CORS

cors = CORS()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Server
Flask==0.11.1
Flask-API==0.6.9
Flask-CORS == 3.0.2
webargs==1.4.0

# Models
Expand Down

0 comments on commit 822884d

Please sign in to comment.