A fourth task. Main goal - set up lambda and s3.
Requirements:
- Poetry
- Python (preferably 3.12.4)
- Docker
First step is to set up env variables in .env file:
SECRET_KEY
: A secret key used for cryptographic purposes, ensuring secure signing of data in the application.DB_NAME
: The name of the database being used in the application.DB_USER
: The username used to authenticate and access the database.DB_PASSWORD
: The password associated with the database user for authentication.DB_HOST
: The host address of the database server.DB_PORT
: The port number used to connect to the database.AWS_ACCESS_KEY_ID
: The access key ID for your AWS account.AWS_SECRET_ACCESS_KEY
: The secret key associated with your access key ID.AWS_SECURITY_TOKEN
: A temporary session token.AWS_STORAGE_BUCKET_NAME
: The name of an Amazon S3 bucket used for storing media and static files.
To run app execute next command:
docker compose up
To run unit tests you need to install dev dependencies:
poetry install --with dev
Also, if you want to test the lambda and s3 functionality, you have to start moto server and docker:
sudo systemctl start docker
moto_server -H 0.0.0.0
To run tests use:
poetry run python -m pytest