Here's a single README file with all the instructions, settings, and code combined:
# Django Project Template with Tailwind CSS and Django BrowserReload
This is a Django project template that comes pre-configured with Tailwind CSS and Django BrowserReload for a streamlined development experience.
## Prerequisites
- Python (3.6 or later)
- Node.js (12.x or later)
- npm (installed with Node.js)
## Setup
1. **Clone the repository**
```bash
git clone https://github.com/your-username/django-tailwind-template.git
cd django-tailwind-template
python -m venv env
source env/bin/activate # On Windows, use `env\Scripts\activate`
pip install django django-tailwind django-browser-reload
python manage.py tailwind install
theme
python manage.py tailwind init theme
theme
app to INSTALLED_APPS
in settings.py
INSTALLED_APPS = [
# ...
'tailwind',
'theme',
'django_browser_reload',
# ...
]
settings.py
TAILWIND_APP_NAME = 'theme'
settings.py
# Django BrowserReload settings
# ------------------------------------------------------------------------------
# https://github.com/django-browser-reload/django-browser-reload
INTERNAL_IPS = [
"127.0.0.1", # Add your local IP address here
]
BROWSER_RELOAD_IMPORT_STRINGS = [
"django_browser_reload.utils.get_modules",
]
BROWSER_RELOAD_LIVE_RELOAD = True
BROWSER_RELOAD_LIVE_RELOAD_IGNORE = [
r"static/.*",
r"media/.*",
]
base.html
in the templates
directory{% load tailwind_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}My App{% endblock %}</title>
{% tailwind_css %}
</head>
<body>
<div class="container mx-auto">
{% block content %}
{% endblock %}
</div>
{% if request.user.is_staff %}
{% browser_reload_script %}
{% endif %}
</body>
</html>
python manage.py runserver
You're all set! You can now start building your Django project with Tailwind CSS and Django BrowserReload pre-configured.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.
This README file includes:
- Prerequisites
- Step-by-step setup instructions
- Code snippets for `settings.py` and `base.html`
- Usage instructions
- Contributing guidelines
- License information
You can copy and paste this entire README file into a text file and include it in your Django project template repository for reference.