e11sync-static
This commit is contained in:
parent
1067e09050
commit
59026d0fb6
@ -1,17 +1,21 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
|
# All that comes from the environment needs to be defined here
|
||||||
|
_DEBUG = bool(environ.get('E11SYNC_DEBUG', False))
|
||||||
|
_STATIC_ROOT = environ.get('E11SYNC_STATIC_ROOT', '/tmp/e11sync-static')
|
||||||
|
_GEOIP_PATH = environ.get("GEOIP_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
|
########################################
|
||||||
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
## No more side effects after this place
|
||||||
|
########################################
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = 'django-insecure-$e2!=equ(efm0e%f9&t+xjtz0)$*$@pw%rnjdqcl8f@5o5hw!l'
|
SECRET_KEY = 'django-insecure-$e2!=equ(efm0e%f9&t+xjtz0)$*$@pw%rnjdqcl8f@5o5hw!l'
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
DEBUG = _DEBUG
|
||||||
DEBUG = True
|
|
||||||
|
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = []
|
||||||
|
|
||||||
@ -19,8 +23,7 @@ INTERNAL_IPS = ["127.0.0.1"]
|
|||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = (['debug_toolbar'] if DEBUG else []) + [
|
||||||
'debug_toolbar',
|
|
||||||
'compressor',
|
'compressor',
|
||||||
'signup.apps.SignupConfig',
|
'signup.apps.SignupConfig',
|
||||||
|
|
||||||
@ -32,9 +35,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = (['debug_toolbar.middleware.DebugToolbarMiddleware'] if DEBUG else []) + [
|
||||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
||||||
|
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
@ -102,7 +103,7 @@ STATICFILES_FINDERS = [
|
|||||||
"compressor.finders.CompressorFinder",
|
"compressor.finders.CompressorFinder",
|
||||||
]
|
]
|
||||||
|
|
||||||
STATIC_ROOT = '/tmp/e11sync-static'
|
STATIC_ROOT = _STATIC_ROOT
|
||||||
|
|
||||||
COMPRESS_PRECOMPILERS = (
|
COMPRESS_PRECOMPILERS = (
|
||||||
# TODO: --style=compressed + source maps
|
# TODO: --style=compressed + source maps
|
||||||
@ -126,4 +127,4 @@ LOGGING = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOIP_PATH = environ["GEOIP_PATH"]
|
GEOIP_PATH = _GEOIP_PATH
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Run administrative tasks."""
|
"""Run administrative tasks."""
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'e11sync.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'e11sync.settings')
|
||||||
|
19
flake.nix
19
flake.nix
@ -52,9 +52,28 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
packages.e11sync-static = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "e11sync-static";
|
||||||
|
src = self;
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
python3Packages.django_5
|
||||||
|
python3Packages.django-compressor
|
||||||
|
dart-sass
|
||||||
|
python3
|
||||||
|
];
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out/static
|
||||||
|
env \
|
||||||
|
E11SYNC_STATIC_ROOT=$out/static \
|
||||||
|
E11SYNC_DEBUG= \
|
||||||
|
${pkgs.python3}/bin/python3 \
|
||||||
|
${self}/app/manage.py collectstatic
|
||||||
|
'';
|
||||||
|
};
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
GEOIP_PATH = "${geoip}";
|
GEOIP_PATH = "${geoip}";
|
||||||
|
E11SYNC_DEBUG = "1";
|
||||||
packages = devDeps;
|
packages = devDeps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user