Fix deployment bugs: .env loading and CMD path

This commit is contained in:
Dmitry Belan
2026-09-19 15:09:38 +03:00
parent 8069238c4d
commit 08fc176b5d
2 changed files with 6 additions and 5 deletions
+1 -2
View File
@@ -16,5 +16,4 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/
EXPOSE 8111
CMD ["gunicorn", "--bind", "0.0.0.0:8111", "lmsege.wsgi:application"]
CMD ["gunicorn", "--bind", "0.0.0.0:8111", "--chdir", "/app/lmsege", "lmsege.wsgi:application"]
+5 -3
View File
@@ -20,7 +20,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
env = environ.Env(
DEBUG=(bool, False)
)
environ.Env.read_env(os.path.join(BASE_DIR.parent, '.env'))
env_file = os.path.join(BASE_DIR.parent, '.env')
if os.path.exists(env_file):
environ.Env.read_env(env_file)
# Quick-start development settings - unsuitable for production
@@ -127,10 +129,10 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/6.1/howto/static-files/
STATIC_URL = 'static/'
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
MEDIA_URL = 'media/'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'