A simple Django REST API storing data in PostgreSQL database and interacting with http://numbersapi.com. The API is deployed to Heroku at https://django-dates-api.herokuapp.com/dates/.
- it has a perfect library for creating REST APIs - Django REST Framework
- it has a large community and there are many great resources available on the Internet (documentation, tutorials, problems solved by other developers)
- it is a framework I wanted to learn so it was a perfect opportunity to do this
- it is the most preferred database for Django
- it is one of the fastest growing database management systems, alongside its NoSQL brother MongoDB
- it is scalable (unlike SQLite) so there will be no need to replace it if the project gets bigger
- I wanted to learn it too
- it is compatible with Heroku
- add Mock objects of external API responses to the tests
You need to be able to at least run the docker-compose
command. If you are using Windows you can download Docker Desktop.
I highly recommend using Postman for sending requests. You can also use its web app if you don't want to install it.
- POST /dates (requires a json with month and day)
- DELETE /dates/{id} (requires authorization by passing the correct X-API-KEY)
- GET /dates
- GET /popular
You can make requests to local server as well as to the deployed app on Heroku.
Open settings.py
, scroll to DATABASES = { ...
and make sure the 'HOST'
is set to 'localhost'
. Then open your command line or terminal in the root folder and run:
docker-compose up
First build may take some time but after that it launches quickly. Now you can send some requests.
To stop the container press Ctrl+C
.
You can send requests without any configuration.