Skip to content

Commit 099dafc

Browse files
authored
Merge pull request #21 from zafran-ullah/add-docker
add-docker
2 parents d0d401a + fa32941 commit 099dafc

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

service/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
from flask import Flask
99
from service import config
1010
from service.common import log_handlers
11+
from flask_talisman import Talisman
12+
from flask_cors import CORS
1113

1214
# Create Flask application
1315
app = Flask(__name__)
16+
talisman = Talisman(app)
17+
CORS(app)
1418
app.config.from_object(config)
1519

1620
# Import the routes After the Flask app is created
@@ -24,7 +28,8 @@
2428
log_handlers.init_logging(app, "gunicorn.error")
2529

2630
app.logger.info(70 * "*")
27-
app.logger.info(" A C C O U N T S E R V I C E R U N N I N G ".center(70, "*"))
31+
app.logger.info(
32+
" A C C O U N T S E R V I C E R U N N I N G ".center(70, "*"))
2833
app.logger.info(70 * "*")
2934

3035
try:

tests/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +0,0 @@
1-
from flask import Flask
2-
from flask_talisman import Talisman
3-
4-
app = Flask(__name__)
5-
talisman = Talisman(app)
6-
7-
# export talisman so tests can import it
8-
__all__ = ['app', 'talisman']

tests/test_routes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
from service.models import db, Account, init_db
1414
from service.routes import app
1515
from service import talisman
16-
HTTPS_ENVIRON = {'wsgi.url_scheme': 'https'}
1716

1817
DATABASE_URI = os.getenv(
1918
"DATABASE_URI", "postgresql://postgres:postgres@localhost:5432/postgres"
2019
)
2120

2221
BASE_URL = "/accounts"
22+
HTTPS_ENVIRON = {'wsgi.url_scheme': 'https'}
2323

2424

2525
######################################################################
@@ -190,4 +190,3 @@ def test_cors_security(self):
190190
# Check for the CORS header
191191
self.assertEqual(response.headers.get(
192192
'Access-Control-Allow-Origin'), '*')
193-

0 commit comments

Comments
 (0)