Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a01a0da25b | ||
|
|
357099accd |
@@ -0,0 +1,13 @@
|
||||
.git
|
||||
.gitignore
|
||||
.idea
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
.env
|
||||
.venv
|
||||
venv
|
||||
db.sqlite3
|
||||
staticfiles
|
||||
logs
|
||||
*.log
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
# Python 3.12 slim
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Сначала зависимости — чтобы кэшировать слой
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Код приложения
|
||||
COPY . .
|
||||
|
||||
# Миграции + статика при старте контейнера
|
||||
CMD ["sh", "-c", "python manage.py migrate --noinput && python manage.py collectstatic --noinput && gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 2"]
|
||||
@@ -40,6 +40,7 @@ INSTALLED_APPS = [
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
@@ -109,6 +110,14 @@ USE_I18N = True
|
||||
USE_TZ = True
|
||||
|
||||
STATIC_URL = "static/"
|
||||
|
||||
STORAGES = {
|
||||
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
|
||||
"staticfiles": {
|
||||
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
|
||||
},
|
||||
}
|
||||
STATICFILES_DIRS = [BASE_DIR / "static"]
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Секреты — только из .env (см. .env.example)
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "8000:8000"
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- sqlite_data:/app/db.sqlite3
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
sqlite_data:
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
Django>=5.0,<6.0
|
||||
django-axes>=8.3.1
|
||||
python-dotenv>=1.0
|
||||
|
||||
gunicorn>=22.0
|
||||
whitenoise>=6.6
|
||||
|
||||
Reference in New Issue
Block a user