- Django
- Django-Rest-API
- MYSQL database
-
RUN
virtualenv -p python3 envname
if virtualenv is not installed RUNpip install virtualenv
-
Activate virtualenv.
-
RUN
pip install -r requirements.txt
-
create mysql database with name 'usersdb' set username and password in settings.py.
-
Data will be automatically imported from admin.py
-
RUN
python manage.py makemigrations
-
RUN
python manage.py migrate
-
RUN
python manage.py runserver
- For testing you can use Postman application to test the API.
- Get all users with certain parameters:
http://127.0.0.1:8000/api/v1/users/?page=1&limit=10&name=Les&sort=-age
- To GET all users:
http://127.0.0.1:8000/api/v1/users/
- POST add a user with post data:
http:127.0.0.1:8000/api/v1/users/
- GET certain User:
http://127.0.0.1:8000/api/v1/users/1/
- PUT request for updating:
http:127.0.0.1:8000/api/v1/users/1/
- DELETE request:
http:127.0.0.1:8000/api/v1/users/1/