diff --git a/Dockerfile b/Dockerfile index fe98d10a..785bf3f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,4 +27,4 @@ ENV FLASK_APP time_tracker_api EXPOSE 5000 -CMD ["gunicorn", "-b 0.0.0.0:5000", "run:app"] +CMD ["gunicorn", "-b 0.0.0.0:5000", "--timeout 600", "run:app"] diff --git a/requirements/dev.txt b/requirements/dev.txt index eceaca07..e1d4d47d 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -12,7 +12,4 @@ pytest-mock==2.0.0 Faker==4.0.2 # Coverage -coverage==4.5.1 - -# The Debug Toolbar -Flask-DebugToolbar==0.11.0 \ No newline at end of file +coverage==4.5.1 \ No newline at end of file diff --git a/requirements/prod.txt b/requirements/prod.txt index 9b2754b9..b65cfb72 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -28,4 +28,7 @@ SQLAlchemy-Utils==0.36.3 flask_sqlalchemy==2.4.1 # Handling requests -requests==2.23.0 \ No newline at end of file +requests==2.23.0 + +# The Debug Toolbar +Flask-DebugToolbar==0.11.0 \ No newline at end of file diff --git a/tests/smoke_test.py b/tests/smoke_test.py index 48f22422..e2a6e35d 100644 --- a/tests/smoke_test.py +++ b/tests/smoke_test.py @@ -5,14 +5,13 @@ from flask_restplus._http import HTTPStatus from pytest_mock import MockFixture +unexpected_errors_to_be_handled = [pyodbc.OperationalError] + def test_app_exists(app): assert app is not None -unexpected_errors_to_be_handled = [pyodbc.OperationalError] - - @pytest.mark.parametrize("error_type", unexpected_errors_to_be_handled) def test_exceptions_are_handled(error_type, client: FlaskClient, mocker: MockFixture): from time_tracker_api.time_entries.time_entries_namespace import time_entries_dao diff --git a/time_tracker_api/config.py b/time_tracker_api/config.py index ab947500..005a655a 100644 --- a/time_tracker_api/config.py +++ b/time_tracker_api/config.py @@ -2,6 +2,8 @@ from time_tracker_api.security import generate_dev_secret_key +DISABLE_STR_VALUES = ("false", "0", "disabled") + class Config: SECRET_KEY = generate_dev_secret_key() @@ -32,13 +34,14 @@ class TestConfig(SQLConfig): class ProductionConfig(Config): - DEBUG = False + DEBUG = os.environ.get('DEBUG', "false").lower() not in DISABLE_STR_VALUES FLASK_DEBUG = True FLASK_ENV = 'production' class AzureConfig(SQLConfig): - DATABASE_URI = os.environ.get('SQLAZURECONNSTR_DATABASE_URI') + DATABASE_URI = os.environ.get('DATABASE_URI', os.environ.get('SQLAZURECONNSTR_DATABASE_URI')) + SQLALCHEMY_DATABASE_URI = DATABASE_URI class AzureDevelopmentConfig(DevelopmentConfig, AzureConfig):