This is a Django template project intended as a base for other web applications. It includes:
- 🏠 A homepage
- ℹ️ An "About Us" page
- 📬 A contact form
- 🤖 An AI Advisor chatbot powered by Google's Gemini API
It is structured for modularity and ease of extension.
- Python 3.6+ (tested with Python 3.10.13)
pip(Python package manager)git(optional but recommended)
Clone this template to your local machine using:
git clone https://github.com/Lluc24/django-base.git
cd django-base-
Create a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
-
Install the dependencies:
pip install -r requirements.txt
-
Apply database migrations (SQLite3):
python manage.py migrate
The advisor chatbot uses Google Gemini to generate responses.
-
Get an API key at:
-
Add it to your environment variables:
export GOOGLE_API_KEY="your_api_key" # On Windows: set GOOGLE_API_KEY=your_api_key
To run the project on your local machine:
python manage.py runserverThen open your browser at http://localhost:8000
The directory structure and relevant files of the project is:
.
├── advisor/ # Chatbot app with Gemini integration
│ ├── admin.py
│ ├── apps.py
│ ├── forms/
│ ├── migrations/
│ ├── models/
│ │ └── chat_message.py
│ ├── templates/advisor/
│ │ └── chatmessage_form.html
│ ├── tests/
│ ├── urls.py
│ ├── utils/
│ └── views/
│ └── chat_form_view.py
│
├── base/ # Base pages (home, contact, about)
│ ├── admin.py
│ ├── apps.py
│ ├── forms/
│ ├── migrations/
│ ├── models/
│ │ └── contact.py
│ ├── static/base/
│ │ ├── background.css
│ │ └── favicon.jpeg
│ ├── templates/base/
│ │ ├── about-us.html
│ │ ├── base-form.html
│ │ ├── base-template.html
│ │ ├── contact_detail.html
│ │ ├── contact_form.html
│ │ └── home.html
│ ├── tests/
│ ├── urls.py
│ ├── utils/
│ └── views/
|
├── LICENSE
│
├── mysite/ # Django project settings and configuration
│ ├── asgi.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
│
├── manage.py
├── requirements.txt
└── README.md
Visit the following route in your browser:
/chat/
Ask questions and interact with the AI-powered advisor. Session-based chat history is preserved during your visit.
You can extend this template by adding:
- User authentication
- Admin dashboards
- RESTful APIs using Django REST Framework (DRF)
- Bootstrap or TailwindCSS for responsive UI
- Deployment configurations (Docker, Gunicorn, Nginx, etc.)
Feel free to fork the project and adapt it to your needs. Contributions, bug reports, and suggestions are always welcome!
This project is released under the MIT License. See LICENSE for details.