Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 3.16 KB

README.md

File metadata and controls

76 lines (51 loc) · 3.16 KB

FastAPI Starter

This repository is a batteries included starter project template for the FastAPI framework with the following features:

Requirements:

If you are using Visual Studio Code, install the recommended extensions.

Setup

Run the Setup Script to install the project dependencies. This will also create a Python virtual environment you can activate using the activate scripts in the venv scripts folder.

Make sure to update your editor settings to use the virtual environment to enable linting and autoformatting!

Debugging

Update or create an ./.env file containing your local environment settings.

The following settings are required to start the application.

TENANT_ID= # Your Azure AD Tenant ID
API_CLIENT_ID= # The Azure AD Application ID used by your API
OPENAPI_CLIENT_ID= # The Azure AD Application ID used by the OpenAPI frontend

You can find additional configuration options in the config.py file.

Run the following docker command or use the tasks to setup your local docker environment.

docker compose -f docker-compose.debug.yml up -d

After the containers are running you will be able to attach the debugger to the API and set breakpoints using the Python: Remote Attach launch configuration. The Python debugger will be listening on port 5678.

You can open your browser at localhost:5050 to connect to your local database using pgAdmin with the following credentials.

Username: [email protected]
Password: admin

The default database is main. To connect to the pre-configured postgres server use the following credentials.

Username: postgres
Password: postgres

Migrations

Create automatic revisions from your SQLAlchemy ORM models.

alembic revision --autogenerate -m "Descriptive Message"

Migrations will automatically be applied on the next application start or can be manually applied using the following command.

alembic upgrade head