/testDjango

API endpoint && codespace setup

Primary LanguagePython

testdjango Repository

This repository contains a basic Django setup for applying CRUD (Create, Read, Update, Delete) operations in an API. It uses Django and Django Rest Framework to create a simple API for managing movies. Follow the instructions below to set up and run the project.

Demo Images

  • img1.png
  • img2.png
  • img3.png
  • img4.png

Prerequisites

Before you begin, ensure you have the following requirements installed:

  • Django
  • Django Rest Framework
  • Requests

You can install these dependencies by running:

pip install -r requirements.txt

Getting Started

  1. Clone this repository to your local machine:
git clone https://github.com/auscode/testdjango.git
  1. Navigate to the project directory:
cd testdjango
  1. Migrate the database:
python manage.py migrate
  1. Create a superuser for accessing the Django admin interface:
python manage.py createsuperuser

Follow the prompts to create a superuser account.

  1. Start the development server:
python manage.py runserver

The development server will be available at http://127.0.0.1:8000/.

API Endpoints

This project provides the following API endpoints for managing movies:

  • GET /movies/: Retrieve a list of all movies.
  • POST /movies/: Create a new movie.
  • GET /movies/{id}/: Retrieve details of a specific movie.
  • PUT /movies/{id}/: Update details of a specific movie.
  • DELETE /movies/{id}/: Delete a specific movie.

Usage

You can use tools like curl, Postman, or write your own client to interact with the API. Here is an example of creating a new movie using curl:

curl -X POST -H "Content-Type: application/json" -d '{
    "name": "URI",
    "description": "A war-ridden movie"
}' http://127.0.0.1:8000/movies/

Feel free to modify and expand upon this basic setup to meet your specific requirements for CRUD operations in your Django API.

For any questions or issues, please create a GitHub issue in this repository. Happy coding!