A Django-based web application for managing a car dealership. Users can browse, add, edit, and delete car listings, manage customer complaints, and view sales statistics through an intuitive and user-friendly interface.
- Features
- Technologies
- Prerequisites
- Installation
- Environment Variables
- Running the Application
- Project Structure
- Contact
- Car Management: Add, edit, and delete car listings with details like brand, model, price, and images.
- Complaint Management: Handle customer complaints efficiently.
- Sales Statistics: View insights and analytics on car sales.
- User Authentication: Secure login and registration for users and admins.
- Responsive Design: User-friendly interface compatible with desktop and mobile devices.
- Search and Filtering: Advanced search and filter options for car listings.
- Python: 3.8+
- Django: 5.x
- Database: MySQL (recommended) or SQLite (for development)
- Pipenv: For dependency management and virtual environment
- Bootstrap: For responsive front-end styling
- Font Awesome: For icons
Before you begin, ensure you have the following installed:
- Python (version 3.8 or higher)
- Pipenv (
pip install pipenv
) - MySQL (if using MySQL) or SQLite (included with Python)
- Git
Follow these steps to set up the project locally:
-
Clone the repository:
git clone https://github.com/fadel-hasan/Car-Dealership.git cd Car-Dealership
-
Install Pipenv (if not already installed):
pip install pipenv
-
Set up the virtual environment and install dependencies:
pipenv install
This will install all dependencies listed in
Pipfile
. -
Activate the virtual environment:
pipenv shell
-
Set up environment variables:
- Copy the example environment file:
cp .env.example .env
- Edit the
.env
file to include your configuration (see Environment Variables for details).
- Copy the example environment file:
-
Configure the database:
- If using MySQL, ensure the database is created and running. Update the database settings in
.env
. - If using SQLite, no additional setup is required (a
db.sqlite3
file will be created automatically).
- If using MySQL, ensure the database is created and running. Update the database settings in
-
Apply database migrations:
python manage.py migrate
-
(Optional) Create a superuser for admin access:
python manage.py createsuperuser
Follow the prompts to set up an admin account.
Create a .env
file in the project root with the following variables:
# Django settings
SECRET_KEY=your-secret-key-here
DEBUG=True # Set to False in production
# Database settings (MySQL example)
DB_ENGINE=django.db.backends.mysql
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_HOST=localhost
DB_PORT=3306
# Database settings (SQLite example, uncomment if using SQLite)
# DB_ENGINE=django.db.backends.sqlite3
# DB_NAME=db.sqlite3
# Other settings (optional)
ALLOWED_HOSTS=localhost,127.0.0.1
- SECRET_KEY: Generate a secure key (e.g., using
django.core.management.utils.get_random_secret_key()
). - DEBUG: Set to
True
for development,False
for production. - Database settings: Configure based on whether you're using MySQL or SQLite.
- ALLOWED_HOSTS: Add your domain or IP in production.
-
Ensure the virtual environment is activated:
pipenv shell
-
Start the development server:
python manage.py runserver
-
Open your browser and navigate to:
http://localhost:8000
-
Access the admin panel (if you created a superuser):
http://localhost:8000/admin
Car-Dealership/
├── .env.example # Example environment file
├── .gitignore # Git ignore file
├── Pipfile # Pipenv dependency file
├── Pipfile.lock # Locked dependency versions (optional)
├── README.md # This file
├── manage.py # Django management script
├── media/ # User-uploaded files (not tracked by Git)
├── static/ # Static files (CSS, JS, images)
├── carDealership/ # Main Django inner peoject
├── carDealer/ # Main Django app
│ ├── migrations/ # Database migrations
│ ├── templates/ # HTML templates
│ ├── __init__.py
│ ├── admin.py
│ ├── models.py
│ ├── settings.py
│ ├── urls.py
│ ├── views.py
└── requirements.txt # Optional, for non-Pipenv users
For questions or feedback, please contact:
- Email: [email protected]
- GitHub Issues: Open an issue