This RESTful API will provides endpoints for CRUD operations.
- Clone the repo.
- navigate to the repo.
- Set virtual environment.
python3 -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt - Navigate to project folder:
cd yourLifeStory - Your PWD should be:
<some path>/your-lifestory-api/yourLifeStory - Sync your database for the first time:
python manage.py migrate - (OPTIONAL) Create a superuser to play around with the api:
python manage.py createsuperuser --username admin --email admin@example.com - Storage(media files) is AWS based so this will not work until AWS environment variables are set up.
- Copy the environment file:
cp .env.sample .env - The AWS variables can be found from their respective services' console.
- The CLOUDFRONT_PRIVATE_KEY needs to be addes base64 encoded format.
- Additional environment variables for production can be found in the AppRunner Instance Configuration.
The key difference is the inclusion of the serializer.py file which translates models to json data. This translation is at the discretion of the developer.
You will find some lines of code commented out. This is mainly in setting.py && entrypoint.sh This code is essential for the production environment and therefore not removed. It has been commented out to reduce the complexity of the development environment.
The database during development is the the default sqlite3. This will be changed to postgreSQL during deployment. The lighter db makes development much smoother, and since DRF has a built-in ORM this shouldn't affect the existing code.
The main tests in place are for the api endpoints that only require communication with the database. Storage(media files) is AWS based so that has been manually tested. You can find the testing coverage report at htmlcov/index.html
Currently, I would recommend going through the DRF docs instead of the Django docs so that everyone gets familiar with the api.