Skip to content

Ignore or Un-ignore Files

By default, if your app uses git, any .gitignore file in your repository will be respected when deploying to FastAPI Cloud.

This means that any files or directories specified in .gitignore will not be uploaded to the cloud during deployment.

You can create a .fastapicloudignore file to specify files or directories that you want to ignore or un-ignore during deployment.

This file works similarly to .gitignore, but it takes precedence over it.

For example, if you want to ignore a directory called largefiles/ that is not listed in your .gitignore, you can add the following line to your .fastapicloudignore file:

largefiles/

Un-ignoring Files with .fastapicloudignore

Section titled “Un-ignoring Files with .fastapicloudignore”

You can also use the .fastapicloudignore file to un-ignore files or directories that would be ignored by default.

For example, if you have a frontend application that generates a dist directory, and that would be excluded by your .gitignore, you can un-ignore it so that those files are available for your deployed app in FastAPI Cloud.

You could add the following line to your .fastapicloudignore file:

!dist/

This will ensure that the dist directory is included during deployment, even if it is listed in your .gitignore file.

When to Use .gitignore vs .fastapicloudignore

Section titled “When to Use .gitignore vs .fastapicloudignore”
ScenarioFile to UseExample
Files not needed in git or deployment.gitignore.venv/, __pycache__/
Files tracked in git but not needed for deployment (optional).fastapicloudignoretests/, docs/, scripts/
Files ignored by git but needed for deployment (e.g: frontend build).fastapicloudignore with !!dist/