diff --git a/Pipfile b/Pipfile index 4d4569faf..e77ab576b 100644 --- a/Pipfile +++ b/Pipfile @@ -28,6 +28,7 @@ uvicorn = "*" starlette = "==0.11.1" pydantic = "==0.23.0" databases = {extras = ["sqlite"],version = "*"} +hypercorn = "*" [requires] python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock index 4b78cfa5d..66885df93 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "02367d250c6327eac80dfcd8e5ccfa49bcdca0332bc757d527c3db27643baa0d" + "sha256": "6cb8497fe3811f43ce664ab69859187b1f698b8b75b0bde627207497ed422cde" }, "pipfile-spec": 6, "requires": { @@ -54,6 +54,42 @@ "markers": "python_version < '3.7'", "version": "==0.6" }, + "h11": { + "hashes": [ + "sha256:acca6a44cb52a32ab442b1779adf0875c443c689e9e028f8d831a3769f9c5208", + "sha256:f2b1ca39bfed357d1f19ac732913d5f9faa54a5062eca7d2ec3a916cfb7ae4c7" + ], + "version": "==0.8.1" + }, + "h2": { + "hashes": [ + "sha256:c8f387e0e4878904d4978cd688a3195f6b169d49b1ffa572a3d347d7adc5e09f", + "sha256:fd07e865a3272ac6ef195d8904de92dc7b38dc28297ec39cfa22716b6d62e6eb" + ], + "version": "==3.1.0" + }, + "hpack": { + "hashes": [ + "sha256:0edd79eda27a53ba5be2dfabf3b15780928a0dff6eb0c60a3d6767720e970c89", + "sha256:8eec9c1f4bfae3408a3f30500261f7e6a65912dc138526ea054f9ad98892e9d2" + ], + "version": "==3.0.0" + }, + "hypercorn": { + "hashes": [ + "sha256:cfe7811a93ab7bc22c8a0d5514a2a7a512e812c1e4ee13b9731b705b79d4d453", + "sha256:f2577806223fa44d57d6f136b6c37a046794f961252699aec8afb15f35d226d5" + ], + "index": "pypi", + "version": "==0.5.4" + }, + "hyperframe": { + "hashes": [ + "sha256:5187962cb16dcc078f23cb5a4b110098d546c3f41ff2d4038a9896893bbd0b40", + "sha256:a9f5c17f2cc3c719b917c4f33ed1c61bd1f8dfac4b1bd23b7c80b3400971b41f" + ], + "version": "==5.2.0" + }, "immutables": { "hashes": [ "sha256:10861f2a2b86139f0c91d5073392d76117f37e84f912dc47c943c23a64008cc7", @@ -83,6 +119,12 @@ "index": "pypi", "version": "==0.23.0" }, + "pytoml": { + "hashes": [ + "sha256:ca2d0cb127c938b8b76a9a0d0f855cf930c1d50cc3a0af6d3595b566519a1013" + ], + "version": "==0.1.20" + }, "sqlalchemy": { "hashes": [ "sha256:91c54ca8345008fceaec987e10924bf07dcab36c442925357e5a467b36a38319" @@ -95,6 +137,21 @@ ], "index": "pypi", "version": "==0.11.1" + }, + "typing-extensions": { + "hashes": [ + "sha256:07b2c978670896022a43c4b915df8958bec4a6b84add7f2c87b2b728bda3ba64", + "sha256:f3f0e67e1d42de47b5c67c32c9b26641642e9170fe7e292991793705cd5fef7c", + "sha256:fb2cd053238d33a8ec939190f30cfd736c00653a85a2919415cecf7dc3d9da71" + ], + "version": "==3.7.2" + }, + "wsproto": { + "hashes": [ + "sha256:55c3da870460e8838b2fbe4d10f3accc0cea3a13d5e8dbbdc6da5d537d6d44dc", + "sha256:c7f35e0af250b9f25583b090039eb2159a079fbe71b7daf86cc3ddcd2f3a70b3" + ], + "version": "==0.14.0" } }, "develop": { @@ -121,10 +178,10 @@ }, "autoflake": { "hashes": [ - "sha256:c103e63466f11db3617167a2c68ff6a0cda35b940222920631c6eeec6b67e807" + "sha256:6b59e5b9b82e30077499578856282debb81186d10b4f899e8c2e1d616cdef973" ], "index": "pypi", - "version": "==1.2" + "version": "==1.3" }, "backcall": { "hashes": [ @@ -300,11 +357,11 @@ }, "ipython": { "hashes": [ - "sha256:b038baa489c38f6d853a3cfc4c635b0cda66f2864d136fe8f40c1a6e334e2a6b", - "sha256:f5102c1cd67e399ec8ea66bcebe6e3968ea25a8977e53f012963e5affeb1fe38" + "sha256:54c5a8aa1eadd269ac210b96923688ccf01ebb2d0f21c18c3c717909583579a8", + "sha256:e840810029224b56cd0d9e7719dc3b39cf84d577f8ac686547c8ba7a06eeab26" ], "markers": "python_version >= '3.3'", - "version": "==7.4.0" + "version": "==7.5.0" }, "ipython-genutils": { "hashes": [ @@ -497,10 +554,10 @@ }, "nbconvert": { "hashes": [ - "sha256:302554a2e219bc0fc84f3edd3e79953f3767b46ab67626fdec16e38ba3f7efe4", - "sha256:5de8fb2284422272a1d45abc77c07b888127550a6d602ce619592a2b08a474ff" + "sha256:138381baa41d83584459b5cfecfc38c800ccf1f37d9ddd0bd440783346a4c39c", + "sha256:4a978548d8383f6b2cfca4a3b0543afb77bc7cb5a96e8b424337ab58c12da9bc" ], - "version": "==5.4.1" + "version": "==5.5.0" }, "nbformat": { "hashes": [ @@ -610,9 +667,9 @@ }, "pyrsistent": { "hashes": [ - "sha256:3ca82748918eb65e2d89f222b702277099aca77e34843c5eb9d52451173970e2" + "sha256:5403d37f4d55ff4572b5b5676890589f367a9569529c6f728c11046c4ea4272b" ], - "version": "==0.14.11" + "version": "==0.15.1" }, "pytest": { "hashes": [ diff --git a/README.md b/README.md index 7c6224087..70d537bb0 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ FastAPI stands on the shoulders of giants: $ pip install fastapi ``` -You will also need an ASGI server, for production such as uvicorn. +You will also need an ASGI server, for production such as Uvicorn or Hypercorn. ```bash $ pip install uvicorn diff --git a/docs/deployment.md b/docs/deployment.md index a307bd562..4f9c94a39 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,4 +1,4 @@ -It is recommended to use **Docker** for security, replicability, development simplicity, etc. +You can use **Docker** for deployment. It has several advantages like security, replicability, development simplicity, etc. In this section you'll see instructions and links to guides to know how to: @@ -237,7 +237,21 @@ The generated project has instructions to deploy it, doing it takes other 2 min. You can deploy **FastAPI** directly without Docker too. -You just need to install Uvicorn (or any other ASGI server). +You just need to install an ASGI compatible server like: + +* Uvicorn, a lightning-fast ASGI server, built on uvloop and httptools. + +```bash +pip install uvicorn +``` + +* Hypercorn, an ASGI server also compatible with HTTP/2. + +```bash +pip install hypercorn +``` + +...or any other ASGI server. And run your application the same way you have done in the tutorials, but without the `--reload` option, e.g.: @@ -245,9 +259,15 @@ And run your application the same way you have done in the tutorials, but withou uvicorn main:app --host 0.0.0.0 --port 80 ``` +or with Hypercorn: + +```bash +hypercorn main:app --bind 0.0.0.0:80 +``` + You might want to set up some tooling to make sure it is restarted automatically if it stops. -You might also want to install Gunicorn and use it as a manager for Uvicorn. +You might also want to install Gunicorn and use it as a manager for Uvicorn, or use Hypercorn with multiple workers. Making sure to fine-tune the number of workers, etc. diff --git a/docs/index.md b/docs/index.md index 7c6224087..70d537bb0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -82,7 +82,7 @@ FastAPI stands on the shoulders of giants: $ pip install fastapi ``` -You will also need an ASGI server, for production such as uvicorn. +You will also need an ASGI server, for production such as Uvicorn or Hypercorn. ```bash $ pip install uvicorn