diff --git a/.envrc b/.envrc index d7ea6d0..57636cc 100644 --- a/.envrc +++ b/.envrc @@ -11,4 +11,6 @@ layout_postgres() { } layout postgres export PROJECT_DIR=$(pwd) +export WEBPORT=$(($RANDOM + 1100)) +export PGPORT=$(($WEBPORT + 100)) watch_file "$PGDATA/postgresql.conf" diff --git a/Procfile b/Procfile index cd9a46c..070d7cf 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ -web: python ./src/manage.py runserver 0.0.0.0:8000 -db: postgres +web: python ./src/manage.py runserver 0.0.0.0:$WEBPORT +db: postgres -p $PGPORT diff --git a/dev.sh b/dev.sh index e8c311d..12c9275 100755 --- a/dev.sh +++ b/dev.sh @@ -3,8 +3,9 @@ run () { setup find . -name __pycache__ -o -name "*.pyc" -delete - sudo iptables -I INPUT -p tcp --dport 8000 -j ACCEPT - overmind start + sudo iptables -I INPUT -p tcp --dport $WEBPORT -j ACCEPT + overmind start -D + echo "http://$(hostname -f):$WEBPORT" } setup () { diff --git a/src/network_inventory/settings/local.py b/src/network_inventory/settings/local.py index 32c2046..789e90d 100644 --- a/src/network_inventory/settings/local.py +++ b/src/network_inventory/settings/local.py @@ -31,5 +31,6 @@ DATABASES = { "NAME": "django", "USER": os.environ.get("USER"), "HOST": os.environ.get("PGHOST"), + "PORT": os.environ.get("PGPORT"), } }