Fix deployment bugs: .env loading and CMD path
This commit is contained in:
+1
-2
@@ -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"]
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user