Created
September 26, 2017 10:03
-
-
Save liveashish/acd4f62fe92c69ed5c3b3196c89cbf62 to your computer and use it in GitHub Desktop.
A script to install Django, configure nginx, setup gunicorn and run the server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Starting Django Setup..."; | |
sudo apt-get update | |
sudo apt install python-pip | |
sudo pip install git | |
read -p "Enter the .git URL to be cloned:" git_url | |
git clone $git_url | |
sudo pip install gunicorn | |
sudo apt-get install nginx | |
ls;read -p "Enter the Django Project Directory: " $django_project_dir | |
sudo apt-get install libmysqlclient-dev | |
pip install -r $djano_project_dir/requirements.txt | |
echo "Fetching IP..." | |
wget https://gist.githubusercontent.com/liveashish/b00d8bb13bd6d467a666d9e67d1fe5c0/raw/67649417287923f33142453f835137e40022ed8c/find_ip.sh | |
sudo chmod +x find_ip.sh | |
source find_ip.sh | |
echo "Setting up Nginx..." | |
wget https://gist.githubusercontent.com/liveashish/d8c480f80f5276039ce0fa3f924b8306/raw/0ce61ba644f6897392b0f38ffdaab2951d884917/nginx_conf_.conf | |
sudo cp nginx_conf_.conf /etc/nginx/nginx.conf | |
read -p "Enter Django App name which contains wsgi: " $APPNAME | |
echo "Setting up Gunicorn..." | |
wget https://gist.githubusercontent.com/liveashish/ba51fea40f4af7df00c04ee9f9e160e5/raw/57e0f0852839020d145afd8c493667038cc843af/start_gunicorn_ds.sh | |
sudo cp start_gunicorn_ds.sh $django_project_dir/start_gunicorn.sh | |
sudo chmod +x $django_project_dir/start_gunicorn.sh | |
echo "Starting Nginx..." | |
sudo service nginx restart | |
echo "Starting Gunicorn..." | |
sudo $django_project_dir/start_gunicorn.sh | |
echo "Installtion completed! Visit $SERVER_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment