update project
This commit is contained in:
@@ -13,8 +13,14 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
RUN python manage.py collectstatic --noinput 2>/dev/null || true
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "eng_bot_metrics.wsgi:application"]
|
||||
|
||||
@@ -37,12 +37,15 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'corsheaders',
|
||||
'metrics',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
@@ -73,10 +76,14 @@ WSGI_APPLICATION = 'eng_bot_metrics.wsgi.application'
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
||||
|
||||
import os
|
||||
|
||||
DATA_DIR = Path(os.environ.get('DATA_DIR', BASE_DIR))
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'NAME': DATA_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,3 +123,23 @@ USE_TZ = True
|
||||
# https://docs.djangoproject.com/en/6.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||
STORAGES = {
|
||||
"staticfiles": {
|
||||
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
|
||||
},
|
||||
"default": {
|
||||
"BACKEND": "django.core.files.storage.FileSystemStorage",
|
||||
},
|
||||
}
|
||||
|
||||
# Default primary key field type
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
# CORS settings
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
'http://localhost:3000',
|
||||
'http://localhost:3001',
|
||||
'http://frontend:3000',
|
||||
]
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
|
||||
6
entrypoint.sh
Normal file
6
entrypoint.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
python manage.py migrate --noinput
|
||||
|
||||
exec "$@"
|
||||
@@ -2,3 +2,5 @@ Django==6.0
|
||||
asgiref==3.11.0
|
||||
sqlparse==0.5.4
|
||||
gunicorn==23.0.0
|
||||
django-cors-headers==4.6.0
|
||||
whitenoise==6.7.0
|
||||
|
||||
Reference in New Issue
Block a user