This commit is contained in:
alydev 2024-05-09 17:18:17 +10:00
parent 47eb1c84ac
commit 46c5e23dc6
No known key found for this signature in database
GPG key ID: F4D2C7A426DDA1BD
3 changed files with 14 additions and 17 deletions

View file

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

View file

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

View file

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