https://github.com/ju-c/django-ninja-example
An example Django Ninja REST framework project
https://github.com/ju-c/django-ninja-example
django django-ninja
Last synced: 6 months ago
JSON representation
An example Django Ninja REST framework project
- Host: GitHub
- URL: https://github.com/ju-c/django-ninja-example
- Owner: ju-c
- License: mit
- Created: 2022-10-12T15:17:56.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-10T13:37:21.000Z (6 months ago)
- Last Synced: 2025-06-10T14:45:44.833Z (6 months ago)
- Topics: django, django-ninja
- Language: Python
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Django Ninja Example
An example [Django Ninja](https://django-ninja.rest-framework.com/) REST framework project.
### API Endpoints
* **/api/v1/docs** (API documentation [provided by the OpenAPI / Swagger UI](https://github.com/swagger-api/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)
### Test Case Scenarios
* 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.
### Install & Usage
1. Clone the repo:
```
git clone https://github.com/ju-c/django-ninja-example.git
```
2. Move to the base directory:
```
cd django-ninja-example
```
3. Create a new python environment:
```
python -m venv env
```
4. Activate environment:
On Windows:
```
env\Scripts\activate
```
On Linux and Mac:
```
source env/bin/activate
```
5. Install the requirements:
```bash
pip install -r requirements.txt
```
6. Run the migrations:
```
python manage.py makemigrations && python manage.py migrate
```
7. Create a super user:
```
python manage.py createsuperuser
```
8. Run the server:
```
python manage.py runserver
```
### To Do
- Adding a proper authentication management.
- Defining our own exceptions and overriding the defaults provided by Django Ninja.