Skip to content

Commit

Permalink
fix permission issues for running django projects on port 80 w/o root
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurtin committed Oct 10, 2016
1 parent 1f28e65 commit 32ba78e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ Vagrant.configure(2) do |config|
sudo chmod a+x /bin/better_ps1
sudo cp /vagrant/bootstrap/better_ps1.sh /bin/better_ps1
sudo sed -i 's/\r//' /bin/better_ps1
# Lazy `runserver`. Really to circumvent permission issue for port 80.
sudo touch /bin/startserver
sudo chmod a+x /bin/startserver
sudo cp /vagrant/bootstrap/startserver.sh /bin/startserver
sudo sed -i 's/\r//' /bin/startserver
# run script to quickly add Python/Django environments
sudo touch /bin/init_python_env
Expand Down
8 changes: 1 addition & 7 deletions bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,5 @@ echo 'VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv' >> /etc/bash.bashrc
echo "SYNC_FOLDER=${1%/}" >> /etc/bash.bashrc
echo "export SYNC_FOLDER=${1%/}" >> /etc/bash.bashrc


# Lazy start server
touch /bin/startserver
chmod +x /bin/startserver
echo "python manage.py runserver [::]:$2" >> /bin/startserver

# Reload system environment variables so they are immediately available.
source /etc/bash.bashrc
source /etc/bash.bashrc
8 changes: 8 additions & 0 deletions bootstrap/startserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
source /bin/colors

if [ ! -f $PWD/manage.py ]; then
echo -e ${BRED}Navigate to a Django Project folder first!${NIL}
else
sudo $PWD/bin/python manage.py runserver [::]:80
fi

0 comments on commit 32ba78e

Please sign in to comment.