Skip to content

This project is a Django-based FAQ system with multilingual support using Google Translate and caching with Redis.

License

Notifications You must be signed in to change notification settings

Kimforee/faq-multilang-api

Repository files navigation

faq-multilang-api

This project is a Django-based FAQ system with multilingual support using Google Translate and caching with Redis.

Features

  • Store and manage FAQs with automatic translations (English, Hindi, Bengali).
  • WYSIWYG editor support (django-ckeditor).
  • REST API with language selection via ?lang= query parameter.
  • Caching with Redis for optimized performance.
  • Unit testing with pytest.
  • PEP8 compliance using flake8.

Testing : image Home page : image Admin : image

Prerequisites

  • Python 3.10+
  • PostgreSQL or SQLite (default)
  • Redis (for caching)

Docker Build

docker-compose up --build

Admin Panel

Automated Superuser Credentials

Automated superuser is created if docker is used, use the following credentials:
Username: 123
Password: 123
Access Django Admin:

http://127.0.0.1:8000/admin/

create a new superuser using:

python manage.py createsuperuser

Local Setup

  1. Clone the repository:

    git clone https://github.com/Kimforee/faq-multilang-api.git
    cd faq-multilang-api
  2. Create a virtual environment:

    python -m venv venv
    source venv/scripts/activate  # On Windows: venv\Scripts\activate
  3. Ensure Redis is installed and running locally:

    redis-server
  4. Update settings.py to use local Redis:

    CACHES = {
        "default": {
            "BACKEND": "django_redis.cache.RedisCache",
            "LOCATION": "redis://localhost:6379/1",
            "OPTIONS": {
                "CLIENT_CLASS": "django_redis.client.DefaultClient",
            }
        }
    }
  5. Install dependencies:

    pip install -r requirements.txt
  6. Apply migrations:

    python manage.py makemigrations
    python manage.py migrate
  7. Run the server:

    python manage.py runserver

API Usage

Fetch all FAQs (English)

curl http://127.0.0.1:8000/api/faqs/

Fetch FAQs in Hindi

curl http://127.0.0.1:8000/api/faqs/?lang=hi

Fetch FAQs in Bengali

curl http://127.0.0.1:8000/api/faqs/?lang=bn

Running Tests (works with local setup only)

pytest

Code Quality Check

flake8 faqs/

About

This project is a Django-based FAQ system with multilingual support using Google Translate and caching with Redis.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published