diff --git a/netcop_hub/settings.py b/netcop_hub/settings.py index d227be2..cb59873 100644 --- a/netcop_hub/settings.py +++ b/netcop_hub/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -182,6 +183,10 @@ STATICFILES_DIRS = [ BASE_DIR / 'static', ] +# WhiteNoise configuration for static files in production +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' +WHITENOISE_USE_FINDERS = True + # Media files MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR / 'media' diff --git a/requirements.txt b/requirements.txt index 29658b2..d3cf38c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ Pillow==11.3.0 requests==2.32.4 gunicorn==21.2.0 psycopg2-binary==2.9.9 -dj-database-url==2.1.0 \ No newline at end of file +dj-database-url==2.1.0 +whitenoise==6.8.2 \ No newline at end of file diff --git a/run_dev.sh b/run_dev.sh index 86da2c0..76849ba 100755 --- a/run_dev.sh +++ b/run_dev.sh @@ -16,6 +16,17 @@ source venv/bin/activate echo "🔍 Checking database configuration..." python manage.py check_db +# Check for pending migrations +echo "" +echo "🔄 Checking for pending migrations..." +if python manage.py showmigrations --plan | grep -q '\[ \]'; then + echo "⚠️ Found pending migrations. Applying them..." + python manage.py migrate + echo "✅ Migrations applied successfully!" +else + echo "✅ All migrations up to date!" +fi + echo "" echo "🌐 Starting Django server..." echo "Visit: http://localhost:8000"