feature/authentication_and_authorization #2

Merged
Saani merged 2 commits from feature/authentication_and_authorization into main 2025-11-22 16:10:32 +00:00
4 changed files with 43 additions and 3 deletions
Showing only changes of commit bc881c84f9 - Show all commits

3
.gitignore vendored
View File

@ -119,7 +119,6 @@ ipython_config.py
# https://pdm.fming.dev/#use-with-ide # https://pdm.fming.dev/#use-with-ide
.pdm.toml .pdm.toml
meetings
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/ __pypackages__/
@ -128,6 +127,8 @@ __pypackages__/
celerybeat-schedule celerybeat-schedule
celerybeat.pid celerybeat.pid
meetings
# SageMath parsed files # SageMath parsed files
*.sage.py *.sage.py

View File

@ -13,6 +13,8 @@ DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost,127.0.0.1').split(',') ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', 'localhost,127.0.0.1').split(',')
INSTALLED_APPS = [ INSTALLED_APPS = [
'jazzmin', 'jazzmin',
'django.contrib.admin', 'django.contrib.admin',
@ -63,14 +65,26 @@ TEMPLATES = [
WSGI_APPLICATION = 'booking_system.wsgi.application' WSGI_APPLICATION = 'booking_system.wsgi.application'
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.postgresql',
'NAME': BASE_DIR / 'db.sqlite3', '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 = [ AUTH_PASSWORD_VALIDATORS = [
{ {
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',

25
dockerfile Normal file
View File

@ -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"]

Binary file not shown.