An example Django Ninja REST framework project.
- /api/v1/docs (API documentation provided by the OpenAPI / Swagger UI
- /api/v1/blog/blog_posts/ (Blog posts list endpoint)
- /api/v1/blog/new_blog_post/ (Blog post create (POST) endpoint)
- /api/v1/blog/blog_post/{blog_post_id} (Blog post retrieve (GET), update (PUT) and destroy (DELETE) endpoint)
- Get blog post list.
- Get a single blog post.
- Create a blog post with API.
- Update a blog post with API.
- Delete a blog post with API.
-
Clone the repo:
git clone https://github.com/ju-c/django-ninja-example.git
-
Move to the base directory:
cd django-ninja-example
-
Create a new python environment:
python -m venv env
-
Activate environment:
On Windows:
env\Scripts\activate
On Linux and Mac:
source env/bin/activate
-
Install the requirements:
pip install -r requirements.txt
-
Run the migrations:
python manage.py makemigrations && python manage.py migrate
-
Create a super user:
python manage.py createsuperuser
-
Run the server:
python manage.py runserver
- Adding a proper authentication management.
- Defining our own exceptions and overriding the defaults provided by Django Ninja.