/my-django-api

Task from GeeksForGeeks

Primary LanguagePythonGNU General Public License v2.0GPL-2.0

My Django API

This repository contains the code for a Django task that implements user registration, login, and additional functionalities.

Getting Started

Follow these steps to set up and run the Django task:

Prerequisites

  • Python (>=3.6)
  • Pip
  • Virtualenv (optional but recommended)

Installation

  1. Clone the repository:

    git clone https://github.com/AmishaSharma12002/my-django-api.git
    cd my-django-api
  2. Set up a virtual environment (optional but recommended):

    virtualenv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install dependencies:

    pip install -r requirements.txt
  4. Apply database migrations:

    python manage.py migrate

Usage

  • Run the development server:

    python manage.py runserver

    Open http://localhost:8000 in your browser.

  • Run tests:

    python manage.py test

Endpoints

  • User Registration:

    POST /api/register/

    {
      "username": "your_username",
      "password": "your_password"
    }
  • User Login:

    POST /api/login/

    {
      "username": "your_username",
      "password": "your_password"
    }
  • Content Generation:

    POST /api/content-generation/

    {
      "product_title": "Product Title"
    }
  • Image Recognition:

    POST /api/image-recognition/

    Attach an image file.

Learn More