This project was generated using fastapi_template.
This project uses poetry. It's a modern dependency management tool.
To run the project use this set of commands:
poetry install
poetry run python -m neo
This will start the server on the configured host.
You can find swagger documentation at /api/docs
.
You can read more about poetry here: https://python-poetry.org/
## Project structure
```bash
$ tree "neo"
neo
├── conftest.py # Fixtures for all tests.
├── db # module contains db configurations
│ ├── dao # Data Access Objects. Contains different classes to interact with database.
│ └── models # Package contains different models for ORMs.
├── __main__.py # Startup script. Starts uvicorn.
├── services # Package for different external services such as rabbit or redis etc.
├── settings.py # Main configuration settings for project.
├── static # Static content.
├── tests # Tests for project.
└── web # Package contains web server. Handlers, startup config.
├── api # Package with all handlers.
│ └── router.py # Main router.
├── application.py # FastAPI application configuration.
└── lifetime.py # Contains actions to perform on startup and shutdown.
This application can be configured with environment variables.
You can create .env
file in the root directory and place all
environment variables here.
All environment variables should start with "NEO_" prefix.
For example if you see in your "neo/settings.py" a variable named like
random_parameter
, you should provide the "NEO_RANDOM_PARAMETER"
variable to configure the value. This behaviour can be changed by overriding env_prefix
property
in neo.settings.Settings.Config
.
An example of .env file:
NEO_RELOAD="True"
NEO_PORT="8000"
NEO_ENVIRONMENT="dev"
- Run the pytest.
pytest -vv .