Deploying a FastAPI application on a traditional server
In some situations, you may not have the chance to use a serverless platform to deploy your application. Some security or regulatory policies may force you to deploy on physical servers with specific configurations. In this case, it's worth knowing some basic things so that you can deploy your application on traditional servers.
In this section, we'll consider you are working on a Linux server:
- First of all, make sure a recent version of Python has been installed on your server, ideally with the version matching the one you used in development. The easiest way to do this is to set up pyenv, as we saw in Chapter 1, Python Development Environment Setup.
- To retrieve your source code and keep it in sync with your latest developments, you can clone your Git repository on your server. This way, you only have to pull the changes and restart the server process to deploy a new version.
- Set up a Python virtual...