diff --git a/.env b/.env index 5f45878..35b63b6 100644 --- a/.env +++ b/.env @@ -2,4 +2,5 @@ export FLASK_ENV=development export FLASK_ENV_TEST=test export DATABASE_URL="postgres://localhost/sportsmatch_api_db" export JWT_SECRET_KEY=fredperry -export TEST_DATABASE_URL="postgres://localhost/sportsmatch_api_test_db" \ No newline at end of file +export TEST_DATABASE_URL="postgres://localhost/sportsmatch_api_test_db" +export FLASK_RUN_PORT=5000 diff --git a/Pipfile b/Pipfile index f9dc2c5..e43113d 100644 --- a/Pipfile +++ b/Pipfile @@ -19,6 +19,7 @@ sqlalchemy-utils = "*" codecov = "*" pytest-cov = "*" pytest = "*" +gunicorn = "*" [requires] python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index cc4986d..8e5bf1d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "fb5319b418c86a8fa3f607e6f31db290e73d9139b93c8a9bd945fc0f69e2dda5" + "sha256": "a82fd527e8141bcd81b2149553957ff8a68543f554a7fa2b4c176d8e575ba293" }, "pipfile-spec": 6, "requires": { @@ -54,10 +54,10 @@ }, "certifi": { "hashes": [ - "sha256:e4f3620cfea4f83eedc95b24abd9cd56f3c4b146dd0177e83a21b4eb49e21e50", - "sha256:fd7c7c74727ddcf00e9acd26bba8da604ffec95bf1c2144e67aff7a8b50e6cef" + "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3", + "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f" ], - "version": "==2019.9.11" + "version": "==2019.11.28" }, "cffi": { "hashes": [ @@ -194,6 +194,14 @@ "index": "pypi", "version": "==2.4.1" }, + "gunicorn": { + "hashes": [ + "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", + "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" + ], + "index": "pypi", + "version": "==20.0.4" + }, "idna": { "hashes": [ "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..40b0792 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn run:app diff --git a/migrations/env.py b/migrations/env.py index 79b8174..87bb22c 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -8,6 +8,8 @@ from alembic import context + + # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config diff --git a/run.py b/run.py index a1ad067..b3bebb5 100644 --- a/run.py +++ b/run.py @@ -2,8 +2,10 @@ from src.app import create_app +env_name = os.getenv('FLASK_ENV') +app = create_app(env_name) + if __name__ == '__main__': - env_name = os.getenv('FLASK_ENV') - app = create_app(env_name) + port = os.getenv('PORT') # run app - app.run() + app.run(host='https://localhost:5000', port=port)