Dash Django Template is a repository created to provide a skeleton for building Dash applications that utilize Django's powerful Object Relational Mapper (ORM) for database management. This template aims to combine the rapid development and flexibility of Dash with the robust, scalable, and well-structured capabilities of Django.
After experimenting extensively with both Dash and Django, it became evident that Django is an excellent choice for creating robust and scalable web applications. However, for smaller-scale projects that need to be developed quickly, Dash stands out with its ease of use, callback management, and the ability to design layouts entirely in Python.
By integrating Django's ORM with Dash's simplicity, this template allows developers to:
- Quickly create dynamic and visually appealing Dash applications.
- Leverage Django's ORM for scalable, maintainable database schema design and management.
- Lay the foundation for projects that can grow over time without sacrificing maintainability.
- Dash for front-end layouts and interactivity.
- Django ORM for database communication and schema design.
- Ready-to-use skeleton for efficient development.
- Python 3.8+ (preferably the latest version)
- pip (Python package manager)
-
Clone the repository:
git clone https://github.com/yourusername/dash-django-template.git cd dash-django-template
-
Create a Python virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Linux/Mac:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- On Linux/Mac:
-
Install the dependencies:
pip install -r requirements.txt
Database is configurable throught the django settings module (django_db/settings.py) . Default database is sqlite.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3', # or os.path.join(BASE_DIR, 'db.sqlite3')
}
}
Here is an example of configuration for a local MySQL server.
# MYSQL Server (local host)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django_db',
'USER': 'root',
'PASSWORD': 'root',
'HOST': 'localhost', # Use the database host (e.g., IP or hostname)
'PORT': '3306', # MySQL default port
}
}
-
Apply the initial migrations for Django:
python manage.py makemigrations python manage.py migrate
-
Run the development server:
python manage.py runserver
-
Run one of the examples:
python dash_app_download_edit.py
-
Open the application in your browser at
http://127.0.0.1:8000
.
This project is licensed under the MIT License.
Thank you Chat-GPT.