-
Notifications
You must be signed in to change notification settings - Fork 123
Installing pyDash with Nginx and Gunicorn
We will install pyDash and run it using Nginx and Gunicorn. There are other ways you can server wsgi as using uWsgi etc so you can look into those as well if you do not want to use gunicorn.
Run:
sudo yum -y install git python-pip nginx
Centos 6
Run:
sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y install git python-pip nginx
Centos 5
Run:
sudo yum -y install http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
sudo yum -y install git python-pip nginx
Run:
sudo apt-get install git python-pip nginx
Please make sure you change the SECRET_KEY, please see https://docs.djangoproject.com/en/dev/ref/settings/ for more details.
Run:
cd /home
sudo git clone https://github.com/k3oni/pydash
cd pydash
edit pydash/settings.py and change the SECRET_KEY value
sudo pip install -r requirements.txt gunicorn
sudo ./manage.py syncdb
Enter the user information, to create your login user:
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): admin (Enter your desired username)
Email address: [email protected] (Enter your email address)
Password: xxxxx (Enter your desired password)
Password (again): xxxxx (Enter your password again)
Add the config pydash.conf
file under /etc/nginx/conf.d/
:
server {
listen 80;
server_name your_server_name;
access_log /var/log/nginx/pydash_access_log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $remote_addr;
}
}
Start Gunicorn in the background and Nginx:
cd /var/www/pydash/pydash
gunicorn wsgi &
service nginx start
Add the config lines under /etc/nginx/sites-enabled/default
. If pyDash is the only web application you want to run you can delete all the lines in the default
file and add only the following:
server {
listen 80;
server_name your_server_name;
access_log /var/log/nginx/pydash_access_log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $remote_addr;
}
}
Start Gunicorn in the background and Nginx:
cd /var/www/pydash/pydash
gunicorn wsgi &
service nginx start