This project is a Django-based FAQ system with multilingual support using Google Translate and caching with Redis.
- 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
.
- Python 3.10+
- PostgreSQL or SQLite (default)
- Redis (for caching)
docker-compose up --build
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
-
Clone the repository:
git clone https://github.com/Kimforee/faq-multilang-api.git cd faq-multilang-api
-
Create a virtual environment:
python -m venv venv source venv/scripts/activate # On Windows: venv\Scripts\activate
-
Ensure Redis is installed and running locally:
redis-server
-
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", } } }
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py makemigrations python manage.py migrate
-
Run the server:
python manage.py runserver
curl http://127.0.0.1:8000/api/faqs/
curl http://127.0.0.1:8000/api/faqs/?lang=hi
curl http://127.0.0.1:8000/api/faqs/?lang=bn
pytest
flake8 faqs/