docker-composing the debug=True version works

This commit is contained in:
stupidcomputer 2024-06-23 14:05:43 -05:00
parent 38614d477c
commit f8ac92e0ae
5 changed files with 17 additions and 20 deletions

3
.env.dev Normal file
View File

@ -0,0 +1,3 @@
DEBUG=1
SECRET_KEY=foo
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]

View File

@ -1,10 +1,10 @@
version: '3.8'
services: services:
web: web:
build: ./franklincce build: ./app
command: gunicorn franklincce.wsgi:application --bind 0.0.0.0:8000 command: python manage.py runserver 0.0.0.0:8000
volumes: volumes:
- ./franklincce/:/usr/src/franklincce - ./franklincce/:/usr/src/app/
ports: ports:
- 8000:8000 - 8000:8000
env_file:
- ./.env.dev

View File

@ -1,3 +1,4 @@
# pull official base image
FROM python:3.11.4-slim-buster FROM python:3.11.4-slim-buster
# set work directory # set work directory
@ -12,9 +13,5 @@ RUN pip install --upgrade pip
COPY ./requirements.txt . COPY ./requirements.txt .
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
# copy project # copy project
COPY . . COPY . .
RUN mkdir /var/www/static -p
RUN python3 manage.py collectstatic --noinput

View File

@ -10,23 +10,20 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/ https://docs.djangoproject.com/en/4.2/ref/settings/
""" """
import os
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production SECRET_KEY = os.environ.get("SECRET_KEY")
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! DEBUG = bool(os.environ.get("DEBUG", default=0))
SECRET_KEY = 'django-insecure-1%p#re)z*_xd9umo0!1foh(yiz&2=*5q#0b4(m42r0^m%kxli#'
# SECURITY WARNING: don't run with debug turned on in production! # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each.
DEBUG = True # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]'
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
ALLOWED_HOSTS = ["localhost", "192.168.0.87", "127.0.0.1", "[::1]"]
# Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'explorer.apps.ExplorerConfig', 'explorer.apps.ExplorerConfig',

View File

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> {} }:
pkgs.mkShell { pkgs.mkShell {
nativeBuildInputs = with pkgs.python311Packages; [ django pymupdf ]; nativeBuildInputs = with pkgs.python311Packages; [ django pymupdf docker-compose ];
} }