feat(docker): добавление вспомогательных файлов для Docker
- .dockerignore - исключение ненужных файлов при сборке образа - .env.example - пример переменных окружения - backend/eusrr_backend/urls.py - добавлена раздача статических файлов в DEBUG режиме
This commit is contained in:
parent
025f82147c
commit
0c2ad449ef
56
.dockerignore
Normal file
56
.dockerignore
Normal file
@ -0,0 +1,56 @@
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
.github
|
||||
|
||||
# Python
|
||||
__pycache__
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
.venv
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
|
||||
# Django
|
||||
*.log
|
||||
logs/
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
/media
|
||||
/staticfiles
|
||||
/static
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.idea
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Documentation
|
||||
docs/
|
||||
*.md
|
||||
!README.md
|
||||
|
||||
# Test
|
||||
.pytest_cache
|
||||
.coverage
|
||||
htmlcov/
|
||||
.tox/
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env.local
|
||||
|
||||
# Docker
|
||||
docker-compose.override.yml
|
||||
39
.env.example
Normal file
39
.env.example
Normal file
@ -0,0 +1,39 @@
|
||||
# Django Settings
|
||||
DEBUG=False
|
||||
SECRET_KEY=change-me-django-secret-key
|
||||
ALLOWED_HOSTS=localhost,127.0.0.1,web
|
||||
|
||||
# Database Settings
|
||||
USE_SQLITE=False
|
||||
POSTGRES_DB=eusrr
|
||||
POSTGRES_USER=eusrr_user
|
||||
POSTGRES_PASSWORD=change-me-postgres-password
|
||||
DB_HOST=db
|
||||
DB_PORT=5432
|
||||
|
||||
# Redis Settings
|
||||
REDIS_HOST=redis
|
||||
REDIS_PORT=6379
|
||||
|
||||
# Celery Settings
|
||||
CELERY_BROKER_URL=redis://redis:6379/0
|
||||
CELERY_RESULT_BACKEND=redis://redis:6379/1
|
||||
|
||||
# Ports (for development)
|
||||
WEB_PORT=8000
|
||||
|
||||
# LDAP Settings (if used)
|
||||
# LDAP_SERVER_URI=ldap://your-ldap-server
|
||||
# LDAP_BIND_DN=cn=admin,dc=example,dc=com
|
||||
# LDAP_BIND_PASSWORD=your-ldap-password
|
||||
# LDAP_USER_SEARCH_BASE=ou=users,dc=example,dc=com
|
||||
|
||||
# Email Settings (if used)
|
||||
# EMAIL_HOST=smtp.gmail.com
|
||||
# EMAIL_PORT=587
|
||||
# EMAIL_USE_TLS=True
|
||||
# EMAIL_HOST_USER=your-email@example.com
|
||||
# EMAIL_HOST_PASSWORD=your-email-password
|
||||
|
||||
# Other Settings
|
||||
# SITE_URL=http://localhost:8000
|
||||
@ -1,9 +1,11 @@
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.http import FileResponse
|
||||
import os
|
||||
from django.urls import include, path
|
||||
|
||||
|
||||
def serve_service_worker(request):
|
||||
"""Обслуживает Service Worker с правильным content-type и заголовками"""
|
||||
@ -25,10 +27,10 @@ def serve_service_worker(request):
|
||||
from django.http import HttpResponse
|
||||
return HttpResponse(f"Service Worker not found: {e}", status=500)
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("auth/", include("employees.urls_front_auth", namespace="auth_front")),
|
||||
path("documents/", include("documents.urls", namespace="documents")),
|
||||
path("requests/", include("requests_app.urls", namespace="requests")),
|
||||
path("employees/", include("employees.urls_front", namespace="employees")),
|
||||
path("communications/", include("communications.urls", namespace="communications")),
|
||||
@ -39,4 +41,15 @@ urlpatterns = [
|
||||
# Service Worker должен быть в корне для правильного scope
|
||||
path("sw.js", serve_service_worker, name="sw"),
|
||||
path("", include("feed.urls_front", namespace="feed")),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
]
|
||||
|
||||
# Serve static and media files in development
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL,
|
||||
document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.MEDIA_URL,
|
||||
document_root=settings.MEDIA_ROOT)
|
||||
else:
|
||||
# In production, media files should still be served by Django/Daphne
|
||||
urlpatterns += static(settings.MEDIA_URL,
|
||||
document_root=settings.MEDIA_ROOT)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user