This is a Django REST api project that can be used to create and manage Todos and Lists of Todos.
The service should perform CRUD operations on a database of to-do records. The service will be used privately by one user.
A to-do record should consist of the date and time the record was created, the date and time the to-do is due, the date and time the to-do was done, a description of the to-do, and the status of the to-do.
The service should provide valid and appropriate HTTP responses for the type of API resource request.
I am free to use any number of libraries and frameworks that I see fit to use.
- Python 3
- Pipenv
- Django 4.1
- Django Rest Framework
- Django Debug Toolbar
- django_extensions
- Shell scripts
- Docker
- PostgreSQL database (container)
- pgAdmin (container)
- Create a to-do record by specifying the description and desired date and time of completion.
- Retrieve a list of to-do records.
- Update a to-do record with new values for meaningful fields.
- Delete a to-do record.
- Filtering, searching, and sorting to-do records by meaningful fields. (Provided through Admin panel)
- Implements http authentication layer to protect the api from unauthorized write access
- Create lists of todos so it's not just one big list
- Admin panel is configured to allow users to manage their Todos and TodoLists
- Todos and TodoLists are searchable, and sortable by meaningful fields.
» ./manage.py show_urls | grep /api/v1/ | awk '{ print $1 }'
/api/v1/
/api/v1/\.<format>/
/api/v1/api-auth/login/
/api/v1/api-auth/logout/
/api/v1/todolists/
/api/v1/todolists/<id>/
/api/v1/todolists/<id>\.<format>/
/api/v1/todolists\.<format>/
/api/v1/todos/
/api/v1/todos/<id>/
/api/v1/todos/<id>\.<format>/
/api/v1/todos\.<format>/
/docs/
/docs/schema.js
After development setup, view the interactive docs for more detail. http://127.0.0.1:9001/docs/
There a few steps required before local development can be started on a new machine.
Install pipenv
if you don't already have it.
pip install --user pipenv
Run pipenv install --dev
anywhere in the project directory to install all the project dependencies and development dependencies.
Then run pipenv shell
to place your shell into this pipenvs virutal context and enable use of the package dependencies we just installed.
Create a src/.env
file with the following values:
POSTGRES_USER=admin
POSTGRES_PASSWORD=postgres
POSTGRES_DB=todo
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
Install docker if you don't have it.
With docker installed, run the src/start_db.sh
script to download and start a postgres database
and postgres admin
container images.
This src/start_db.sh
script also sources from the src/.env
file we created for basic postgres configurations.
From the src/
directory run either:
- the
./start_app.sh
script to start the Django development server onport 9001
. - or use
./manage.py runserver 9001
- Browsable Api - http://127.0.0.1:9001/api/v1
- Interactive Api Docs - http://127.0.0.1:9001/docs/
- Django Admin - http://127.0.0.1:9001/admin/
- Postgres Admin - http://127.0.0.1:5050/
- django_extensions features are available through the
src/.manage.py
cli