Skip to content

Commit 32ba78e

Browse files
committed
fix permission issues for running django projects on port 80 w/o root
1 parent 1f28e65 commit 32ba78e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

Vagrantfile

+6
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ Vagrant.configure(2) do |config|
113113
sudo chmod a+x /bin/better_ps1
114114
sudo cp /vagrant/bootstrap/better_ps1.sh /bin/better_ps1
115115
sudo sed -i 's/\r//' /bin/better_ps1
116+
117+
# Lazy `runserver`. Really to circumvent permission issue for port 80.
118+
sudo touch /bin/startserver
119+
sudo chmod a+x /bin/startserver
120+
sudo cp /vagrant/bootstrap/startserver.sh /bin/startserver
121+
sudo sed -i 's/\r//' /bin/startserver
116122
117123
# run script to quickly add Python/Django environments
118124
sudo touch /bin/init_python_env

bootstrap/bootstrap.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,5 @@ echo 'VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv' >> /etc/bash.bashrc
7373
echo "SYNC_FOLDER=${1%/}" >> /etc/bash.bashrc
7474
echo "export SYNC_FOLDER=${1%/}" >> /etc/bash.bashrc
7575

76-
77-
# Lazy start server
78-
touch /bin/startserver
79-
chmod +x /bin/startserver
80-
echo "python manage.py runserver [::]:$2" >> /bin/startserver
81-
8276
# Reload system environment variables so they are immediately available.
83-
source /etc/bash.bashrc
77+
source /etc/bash.bashrc

bootstrap/startserver.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
source /bin/colors
3+
4+
if [ ! -f $PWD/manage.py ]; then
5+
echo -e ${BRED}Navigate to a Django Project folder first!${NIL}
6+
else
7+
sudo $PWD/bin/python manage.py runserver [::]:80
8+
fi

0 commit comments

Comments
 (0)