diff --git a/.gitignore b/.gitignore index 64c193b..74ebefb 100644 --- a/.gitignore +++ b/.gitignore @@ -119,7 +119,6 @@ ipython_config.py # https://pdm.fming.dev/#use-with-ide .pdm.toml -meetings # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ @@ -128,6 +127,8 @@ __pypackages__/ celerybeat-schedule celerybeat.pid +meetings + # SageMath parsed files *.sage.py diff --git a/booking_system/settings.py b/booking_system/settings.py index a7cb8cd..024d647 100644 --- a/booking_system/settings.py +++ b/booking_system/settings.py @@ -13,6 +13,8 @@ DEBUG = os.getenv('DEBUG', 'False').lower() == 'true' ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost,127.0.0.1').split(',') + + INSTALLED_APPS = [ 'jazzmin', 'django.contrib.admin', @@ -63,14 +65,26 @@ TEMPLATES = [ WSGI_APPLICATION = 'booking_system.wsgi.application' +# DATABASES = { +# 'default': { +# 'ENGINE': 'django.db.backends.sqlite3', +# 'NAME': BASE_DIR / 'db.sqlite3', +# } +# } + DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': os.getenv('POSTGRES_DB'), + 'USER': os.getenv('POSTGRES_USER'), + 'PASSWORD': os.getenv('POSTGRES_PASSWORD'), + 'HOST': os.getenv('POSTGRES_HOST', 'postgres'), + 'PORT': os.getenv('POSTGRES_PORT', 5432), } } + AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..0b25b33 --- /dev/null +++ b/dockerfile @@ -0,0 +1,25 @@ +FROM python:3.12-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + libpq-dev \ + curl \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir --upgrade pip +RUN pip install --no-cache-dir -r requirements.txt + +COPY . . + +RUN adduser --disabled-password --gecos '' django +RUN chown -R django:django /app +USER django + +RUN python manage.py collectstatic --noinput + +EXPOSE 8000 + +CMD ["gunicorn", "booking_system.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "2"] diff --git a/requirements.txt b/requirements.txt index 5dcc9f6..41195ed 100644 Binary files a/requirements.txt and b/requirements.txt differ