Skip to content

Commit 7f0286c

Browse files
futa-ikedacslzchen
authored andcommitted
CORS for website container
1 parent 929269f commit 7f0286c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

poetry.lock

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ django-elasticsearch-metrics = {git ="https://github.com/CenterForOpenScience/dj
9595
djangorestframework-csv = "3.0.2"
9696
gevent = "24.2.1"
9797
packaging = "^24.0"
98+
flask-cors = "6.0.1"
9899

99100
[tool.poetry.group.dev.dependencies]
100101
pytest = "7.4.4"

website/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from flask_cors import CORS
2+
13
import framework
24
import importlib
35
import json
@@ -6,6 +8,8 @@
68
from collections import OrderedDict
79

810
import django
11+
12+
from api.base.settings import CORS_ORIGIN_WHITELIST
913
from api.caching import listeners # noqa
1014
from django.apps import apps
1115
from framework.addons.utils import render_addon_capabilities
@@ -89,6 +93,7 @@ def init_app(settings_module='website.settings', set_backends=True, routes=True,
8993
if app.config.get('IS_INITIALIZED', False) is True:
9094
return app
9195

96+
CORS(app, supports_credentials=True, origins=CORS_ORIGIN_WHITELIST)
9297
setup_django()
9398

9499
# The settings module

0 commit comments

Comments
 (0)