diff --git a/.gitignore b/.gitignore index dd7d843..00bb18a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ venv/ .idea/ # Logs +/logs *.log *.pot *.mo diff --git a/Dockerfile b/Dockerfile index 62283f2..cd87c4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ RUN pip install --upgrade pip \ # Copy the rest of the application code COPY . . +# Install static files +RUN python manage.py collectstatic --noinput + # Expose Django port EXPOSE 8000 diff --git a/TaskManagerSystem/urls.py b/TaskManagerSystem/urls.py index 45484b6..ae01f14 100644 --- a/TaskManagerSystem/urls.py +++ b/TaskManagerSystem/urls.py @@ -17,6 +17,7 @@ from django.contrib import admin from django.conf import settings +from django.conf.urls.static import static from django.urls import path, include from decouple import config @@ -44,4 +45,6 @@ # Swagger & ReDoc path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), -] \ No newline at end of file +] + +urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 223a26a..27f3849 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,11 +4,15 @@ services: web: build: . container_name: taskmanagersystem - command: gunicorn TaskManagerSystem.wsgi:application --bind 0.0.0.0:8000 + command: > + sh -c " + python manage.py collectstatic --noinput && + gunicorn TaskManagerSystem.wsgi:application --bind 0.0.0.0:8000" ports: - "8000:8000" volumes: - .:/app + - ./staticfiles:/app/staticfiles env_file: - .env.docker depends_on: