This is a basic django application, exploring different topics like rest api, cache, sessions, custom user, jwt, multitenancy and other things.
- User Login (JWT)
- User Register
- User Update
- User Detail
- User Delete/Inactivate
- User authorization
This project demonstrates how to implement authentication using rest_framework_simplejwt
in Django.
- Clone the repository:
git clone git@github.com:gustavovalle23/Basic-RestFramework.git
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
python manage.py makemigrations
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
- Run the development server:
python manage.py runserver
- Use the API by sending requests to the endpoints.
This project provides an API to create and manage users. The API includes the following endpoints:
Returns a list of all users.
- URL:
/users/
- Method:
GET
- Headers:
Authorization: Bearer <access_token>
Creates a new user.
- URL:
/users/
- Method:
POST
- Headers:
Content-Type: application/json
- Data Params:
{ "username": "<username>", "email": "<email>", "password": "<password>", "birth_date": "<YYYY-MM-DD>" }
Retrieves a specific user.
- URL:
/users/<id>/
- Method:
GET
- Headers:
Authorization: Bearer <access_token>
Updates a specific user.
- URL:
/users/<id>/
- Method:
PUT
- Headers:
Authorization: Bearer <access_token>
,Content-Type: application/json
- Data Params:
{ "username": "<username>", "email": "<email>", "password": "<password>", "birth_date": "<YYYY-MM-DD>" }
Deletes a specific user.
- URL:
/users/<id>/
- Method:
DELETE
- Headers:
Authorization: Bearer <access_token>
This project includes tests for the authentication and user endpoints. To run the tests, use the following command:
python manage.py test
This project was created with the help of the rest_framework_simplejwt
library for Django.