Randomize the ports
This should help with port colitions when running multiple projects at once.
This commit is contained in:
parent
86e0ae7c5b
commit
8bf4ee6bbe
2
.envrc
2
.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"
|
||||
|
|
4
Procfile
4
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
|
||||
|
|
5
dev.sh
5
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 () {
|
||||
|
|
|
@ -31,5 +31,6 @@ DATABASES = {
|
|||
"NAME": "django",
|
||||
"USER": os.environ.get("USER"),
|
||||
"HOST": os.environ.get("PGHOST"),
|
||||
"PORT": os.environ.get("PGPORT"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue