diff --git a/.gitignore b/.gitignore index 872fc7f..da8739b 100644 --- a/.gitignore +++ b/.gitignore @@ -173,7 +173,7 @@ migrations/ .vscode/ .pytest_cache/ htmlcov/ -.second_run +.first_run /src/static .idea/ diff --git a/dev.sh b/dev.sh index fc8a532..e6befe3 100755 --- a/dev.sh +++ b/dev.sh @@ -9,7 +9,7 @@ run () { setup () { overmind start -l db -D - if [ -f .second_run ]; then + if [ -f .direnv/first_run ]; then sleep 2 python ./src/manage.py collectstatic --noinput python ./src/manage.py makemigrations @@ -34,7 +34,7 @@ setup () { python ./src/manage.py loaddata nets python ./src/manage.py loaddata softwares python ./src/manage.py shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')" - touch .direnv/.second_run + touch .direnv/first_run fi overmind quit @@ -51,7 +51,7 @@ docker (){ clean () { find . \( -name __pycache__ -o -name "*.pyc" \) -delete rm -rf htmlcov/ - rm -f src/*/migrations/0*.py .direnv/.second_run + rm -f src/*/migrations/0*.py .direnv/first_run } cleanall () { diff --git a/flake.nix b/flake.nix index 76e4a5c..a66a20b 100644 --- a/flake.nix +++ b/flake.nix @@ -106,7 +106,7 @@ pkgs.coreutils inventory (pkgs.writeShellScriptBin "start-inventory" '' - if [ -f .second_run ]; then + if [ -f .first_run ]; then sleep 2 ${pkgs.inventoryEnv}/bin/django-admin collectstatic --noinput ${pkgs.inventoryEnv}/bin/django-admin makemigrations @@ -131,7 +131,7 @@ ${pkgs.inventoryEnv}/bin/django-admin loaddata nets ${pkgs.inventoryEnv}/bin/django-admin loaddata softwares ${pkgs.inventoryEnv}/bin/django-admin shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')" - touch .second_run + touch .first_run fi ${pkgs.inventoryEnv}/bin/gunicorn network_inventory.wsgi:application --reload --bind 0.0.0.0:8000 --workers 3 '')