Skip to content

Commit afd1a5a

Browse files
Add env file to deployment script
1 parent f9a552f commit afd1a5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ venv_dir="$sort_dir/venv"
1717
pip="$venv_dir/bin/pip"
1818
python_version="python3.12"
1919
python="$venv_dir/bin/python"
20+
env_file="$sort_dir/.env"
2021

2122
# Install British UTF-8 locale so we can use this with PostgreSQL.
2223
# This is important to avoid the limitations of the LATIN1 character set.
@@ -25,6 +26,7 @@ sudo locale-gen en_GB.UTF-8
2526
sudo update-locale
2627

2728
# Create Python virtual environment
29+
mkdir --parents "$sort_dir"
2830
apt update -qq
2931
apt install --upgrade --yes -qq "$python_version" "$python_version-venv"
3032
python3 -m venv "$venv_dir"
@@ -33,6 +35,11 @@ python3 -m venv "$venv_dir"
3335
$pip install --quiet -r requirements.txt
3436
cp --recursive * "$sort_dir/"
3537

38+
# Create environment file
39+
sudo touch "$env_file"
40+
sudo chown gunicorn:gunicorn "$env_file"
41+
sudo chmod 600 "$env_file"
42+
3643
# Install static files into DJANGO_STATIC_ROOT
3744
# This runs in a subshell because it's changing directory
3845
(cd "$sort_dir" && exec $python manage.py collectstatic --no-input)

0 commit comments

Comments
 (0)