modern-django-starter/django_project/settings/build.py
amitrana01 7f9093741b Fix missing Tailwind CSS file causing 500 error
- Build Tailwind CSS locally to create missing styles.css file
- Improve Docker build process to properly install and build Tailwind
- Update build.py settings to include all required apps
- Remove debugging from entrypoint script

The 500 error was caused by missing css/dist/styles.css file that the
{% tailwind_css %} template tag was trying to load. Now the file exists
and the Docker build process ensures it's created during build.
2025-09-11 18:12:07 +05:30

45 lines
1.2 KiB
Python

"""
Minimal settings for Docker build process (static file collection)
This file contains only the necessary settings for collectstatic to work during build.
"""
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Security settings (minimal for build)
SECRET_KEY = 'build-time-secret-key-not-for-production'
DEBUG = False
ALLOWED_HOSTS = ['*']
# Static files settings (primary purpose of this file)
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [BASE_DIR / 'static']
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Required apps for static file collection (include all apps that have static files)
INSTALLED_APPS = [
'django.contrib.staticfiles',
'tailwind',
'django_browser_reload',
'theme', # Our Tailwind theme app
'apps.core', # Include our apps in case they have static files
]
# Tailwind CSS Configuration
TAILWIND_APP_NAME = 'theme'
# Minimal database config (not used but required by Django)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
# Disable middleware and other unnecessary components for build
MIDDLEWARE = []
ROOT_URLCONF = None
USE_TZ = True