diff --git a/.env.prod b/.env.prod index 3a45223..2e1a214 100644 --- a/.env.prod +++ b/.env.prod @@ -1,2 +1,2 @@ -SECRET_KEY=change_me +SECRET_KEY=834701 DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6ccb378 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +prod: # execute this target on the production server in the nix-shell + rm -r franklincce/staticfiles + cd franklincce; python3 manage.py collectstatic + sed -i "s/change_me/$(shell shuf -i1-1000000 -n1)/g" .env.prod + docker-compose -f docker-compose.prod.yml up -d --build diff --git a/franklincce/franklincce/settings.py b/franklincce/franklincce/settings.py index 5c5097a..ef56491 100644 --- a/franklincce/franklincce/settings.py +++ b/franklincce/franklincce/settings.py @@ -19,14 +19,14 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.environ.get("SECRET_KEY") -DEBUG = os.environ.get("DEBUG", default=0) -print(DEBUG) -DEBUG = bool(DEBUG) -print(DEBUG) +DEBUG = bool(os.environ.get("DEBUG", default=0)) # 'DJANGO_ALLOWED_HOSTS' should be a single string of hosts with a space between each. # For example: 'DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]' -ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") +try: + ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") +except: + ALLOWED_HOSTS = ["127.0.0.1", "localhost"] INSTALLED_APPS = [ 'explorer.apps.ExplorerConfig', diff --git a/shell.nix b/shell.nix index cdd1fff..05a663c 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ { pkgs ? import {} }: pkgs.mkShell { - nativeBuildInputs = with pkgs.python311Packages; [ django pymupdf ] ++ [pkgs.docker-compose] ; + nativeBuildInputs = with pkgs.python311Packages; [ django pymupdf ] ++ [pkgs.docker-compose pkgs.gnumake] ; }