A Django application for managing Frequently Asked Questions (FAQs) with multi-language support and WYSIWYG editor integration. This project demonstrates the ability to create a RESTful API for managing FAQs, including translation features and caching mechanisms.
- WYSIWYG Editor: Integrated using
django-ckeditorfor rich text formatting of answers. - Multi-language Support: Store translations for FAQs in multiple languages (e.g., Hindi, Bengali).
- REST API: Create, read, update, and delete FAQs via a RESTful API.
- Caching: Implemented caching using Redis to improve performance.
- Automated Translations: Use Google Translate API or
googletransto automate translations during FAQ creation.
- Django 5.x
- Django REST Framework
- django-ckeditor
- Redis (for caching)
- Google Translate API or googletrans
- PostgreSQL or SQLite (for database)
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git cd YOUR_REPO_NAME text
- Create a virtual environment:
python -m venv venv text
- Activate the virtual environment:
-
On Windows:
venv\Scripts\activate -
On macOS/Linux:
source venv/bin/activate
- Install the required packages:
pip install -r requirements.txt text
-
Set up environment variables (if needed) in a
.envfile or directly in your environment. -
Run database migrations:
python manage.py migrate text
- Create a superuser to access the admin panel:
python manage.py createsuperuser text
- Start the development server:
python manage.py runserver text
You can access the application at http://127.0.0.1:8000/. Use the admin panel to manage FAQs or interact with the API directly.
-
Fetch FAQs in English (default): curl http://localhost:8000/api/faqs/ text
-
Fetch FAQs in Hindi: curl http://localhost:8000/api/faqs/?lang=hi text
-
Fetch FAQs in Bengali: curl http://localhost:8000/api/faqs/?lang=bn text
POST /api/faqs/ Content-Type: application/json { "question": "What is Django?", "answer": "
Django is a web framework.
", "question_hi": "डjango क्या है?", "answer_hi": "डjango एक वेब फ्रेमवर्क है।
", "question_bn": "ডjango কি?", "answer_bn": "ডjango একটি ওয়েব ফ্রেমওয়ার্ক।
" } textPUT /api/faqs/{id}/ Content-Type: application/json { "question": "Updated question?", "answer": "
Updated answer.
" } textDELETE /api/faqs/{id}/ text
This application uses Redis to cache translations for improved performance. Ensure that Redis is installed and running on your machine.
Unit tests are written using pytest. To run the tests, execute:
pytest text
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature). - Make your changes and commit them (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/YourFeature). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.