diff --git a/Dockerfile b/Dockerfile index b116685..b71ffbc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ -FROM python:3.12.3 -RUN pip install pipenv --upgrade +FROM python:3.12.3-slim-bullseye +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +RUN pip install pip pipenv --upgrade RUN mkdir -p /usr/src/app WORKDIR /usr/src/app @@ -8,6 +11,6 @@ RUN pipenv lock && pipenv sync COPY . /usr/src/app -EXPOSE 80 +EXPOSE 8000 COPY ./runserver.sh /usr/local/bin/ -CMD ["sh", "runserver.sh"] +CMD ["pipenv", "runserver.sh"] diff --git a/runserver.sh b/runserver.sh index f6abedf..7610f62 100644 --- a/runserver.sh +++ b/runserver.sh @@ -1,4 +1,4 @@ #!/bin/sh python manage.py migrate -python manage.py makesuper -gunicorn demo.wsgi --bind=0.0.0.0:80 +python manage.py createsuperuser --username aly --email aly@aly.pet --noinput +gunicorn xivpet.wsgi:application --bind=0.0.0.0:8000 diff --git a/xivpet/settings.py b/xivpet/settings.py index 5f37ff3..8927d84 100644 --- a/xivpet/settings.py +++ b/xivpet/settings.py @@ -11,9 +11,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/ """ from pathlib import Path -import environ - -env = environ.Env() +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -23,12 +21,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = env("SECRET_KEY") +SECRET_KEY = os.environ.get("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = env.bool("DEBUG") +DEBUG = bool(os.environ.get("DEBUG")) -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ["captain.captain.localhost", "127.0.0.1"] # Application definition @@ -118,11 +116,7 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.0/howto/static-files/ -STATIC_URL = '/static/' -STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static_files')] -STATIC_ROOT = os.path.join(BASE_DIR, 'static_root') -MEDIA_URL = '/media/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +STATIC_URL = 'static/' # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field