SlideShare a Scribd company logo
Django Deployment
Best Practices
Presenter: Premananda Das, Mindfire Solutions
Date: 05/02/2015
About me
Connect Me:
Facebook: https://www.facebook.com/premanandad
Linkedin: https://in.linkedin.com/pub/premananda-das/1a/353/454
Twitter: https://twitter.com/premananda
Google+: https://plus.google.com/117290494758487835690
Contact Me:
Email: premanandad@mindfiresolutions.com / premanandad@gmail.com
Skype: mfsi_prem
Zend PHP Certified and Zend Framework Certified developer.
Skills: PHP, Python, Zend Framework, CodeIgniter, CakePHP, Django,
JavaScript, jQuery,
Mysql, Postgresql, AWS.
Presenter: Premananda Das, Mindfire Solutions
Agenda
Environment setup
Server configuration
Tools
Demo: Deploying in AWS
Q&A
Presenter: Premananda Das, Mindfire Solutions
Environment setup
pip
Virtualenv and Virtualenvwrapper
Django setup
requirements.txt
git
Supervisord
Presenter: Premananda Das, Mindfire Solutions
Environment setup > pip
Its a tool for installing Python packages from PyPI.
Install: sudo apt-get install python-pip
Example:
$ pip install PackageName # latest version
$ pip install PackageName ==1.0.4 # specific version
$ pip install PackageName >=1.0.4' # minimum version
$ pip uninstall PackageName
Presenter: Premananda Das, Mindfire Solutions
Environment setup > Virtualenv
Presenter: Premananda Das, Mindfire Solutions
A tool to create isolated Python environments.
$ pip install virtualenv
Example:
Create Environment: $ virtualenv venv
Activate Environment: $ source venv/bin/activate
Install Packages: $ pip install requests
Deactivate Environment: $ deactivate
Virtualenvwrapper is a set of extensions to virtualenv tool. It
provides commands to make it easy to work with virtualenv.
Create virtual environment: mkvirtualenv mynewenv
List virtual environment: lsvirtualenv
Remove a virtual environment: rmvirtualenv myenv
Environment setup > Django
Presenter: Premananda Das, Mindfire Solutions
Install: $ pip install django
New project: $ django-admin.py startproject myproject
1. Keep the app name concise - simple and one word.
2. Use flake8 to check coding convention - PEP8.
3. django-dotenv - avoid using local_settings.py.
4. Error handling and logging: logger - error and exception with log rotate.
5. DEBUG = False.
6. DB log error and analyse slow queries.
7. django-debug-toolbar for debugging.
8. Don’t reinvent the wheel.
Environment setup > requirements.txt
Presenter: Premananda Das, Mindfire Solutions
$ pip freeze > requirements.txt
$ pip install -r requirements.txt
Environment setup > git
Presenter: Premananda Das, Mindfire Solutions
Ubuntu: sudo apt-get install git
1. Working directory must be kept clean.
2. All files should be committed to git.
3. Server configs can be kept in git.
4. Don’t keep any application and database password in git.
5. Follow process: Gitflow Workflow
Environment setup > git > Gitflow
Workflow
Presenter: Premananda Das, Mindfire Solutions
Environment setup > Supervisord
Presenter: Premananda Das, Mindfire Solutions
A Process Control System
Install:
pip: pip install supervisor —pre
Ubuntu: sudo apt-get install supervisor
Config:
echo_supervisord_conf > /etc/supervisord.conf
$ sudo supervisorctl reload
$ sudo supervisorctl restart uwsgi
Environment setup > Supervisord
Presenter: Premananda Das, Mindfire Solutions
#/etc/supervisor/conf.d/uwsgi.conf
[program:uwsgi]
command=/home/ubuntu/.virtualenvs/venv/bin/uwsgi --ini
/home/ubuntu/myproject/system/uwsgi/uwsgi.ini
directory=/home/ubuntu/myproject
user=www-data
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true
Server configuration
> Nginx
> uWSGI
Presenter: Premananda Das, Mindfire Solutions
The world’s busiest websites use
Server configuration:
Presenter: Premananda Das, Mindfire Solutions
Server configuration > uWSGI
Presenter: Premananda Das, Mindfire Solutions
Install: $ pip install uwsgi
Supervisord conf:
[program:uwsgi]
command=/home/ubuntu/.virtualenvs/venv/bin/uwsgi --ini
/home/ubuntu/myproject/system/uwsgi.ini
directory=/home/ubuntu/myproject
user=www-data
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stopasgroup=true
killasgroup=true
Server configuration > uWSGI
Presenter: Premananda Das, Mindfire Solutions
[uwsgi]
chdir = /home/ubuntu/myproject
module = myproject.wsgi
# the virtualenv (full path)
home = /home/ubuntu/.virtualenvs/venv/
#logger = file:/home/ubuntu/myproject/log/uwsgi.log
# process-related settings
master = true
# maximum number of worker processes
processes = 3
# the socket (use the full path to be safe)
socket = /tmp/myproject.sock
chmod-socket = 666
# clear environment on exit
vacuum = true
Server configuration > Nginx
Presenter: Premananda Das, Mindfire Solutions
Install: sudo apt-get install nginx
Process:
Start: sudo service nginx start
Stop: sudo service nginx stop
Check Status: sudo service nginx status
Restart: sudo service nginx restart
Server Config:
/etc/nginx/sites-enabled/web-http.conf
server {
listen 80;
server_name myserver.com;
return 301 https://$server_name$request_uri;
}
Server configuration > nginx
Presenter: Premananda Das, Mindfire Solutions
/etc/nginx/sites-enabled/web-https.conf
server {
listen 443;
server_name myserver.com;
root /home/ubuntu/myproject/static;
client_max_body_size 4G;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl on;
ssl_certificate /etc/nginx/ssl/certs/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/certs/myserver_com.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
Continued…
Server configuration > nginx
Presenter: Premananda Das, Mindfire Solutions
location / {
uwsgi_pass django;
include /home/ubuntu/myproject/system/uwsgi/uwsgi_params;
}
location /static/ {
alias /home/ubuntu/myproject/myproject/static/;
}
}
upstream django {
server unix:///tmp/guinness.sock; # for a file socket
}
uwsgi_params:
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
Tools
Presenter: Premananda Das, Mindfire Solutions
1. New Relic: Server and application monitoring
2. Sentry: Gives insight into the application errors
3. Jenkins for CI, unittest
4. Fabric: Application deployment or system administration tasks
over SSH.
Demo > Deploying in
AWS
Presenter: Premananda Das, Mindfire Solutions
Any Questions?
Presenter: Premananda Das, Mindfire Solutions
References Link
Presenter: Premananda Das, Mindfire Solutions
pip: https://pip.pypa.io/en/latest/reference/pip_install.html
git: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-
workflow
virtualenvwrapper: http://virtualenvwrapper.readthedocs.org/en/latest/
uwsgi: http://uwsgi-
docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
Supervisord: http://supervisord.org/installing.html
nginx: http://nginx.com/
uWSGI+nginx: https://www.digitalocean.com/community/tutorials/how-to-
deploy-python-wsgi-applications-using-uwsgi-web-server-with-nginx
Sentry: https://getsentry.com/welcome/
New Relic: http://newrelic.com/
Presenter: Premananda Das, Mindfire Solutions
Thank You !!
www.mindfiresolutions.com
https://www.facebook.com/MindfireSolutions
http://www.linkedin.com/company/mindfire-solutions
http://twitter.com/mindfires

More Related Content

PPTX
Django deployment best practices
PDF
Towards Continuous Deployment with Django
PDF
Deploying on the cutting edge
PDF
“warpdrive”, making Python web application deployment magically easy.
PDF
Making the most of your Test Suite
KEY
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PDF
Zero Downtime Deployment with Ansible
PDF
Testing Django Applications
Django deployment best practices
Towards Continuous Deployment with Django
Deploying on the cutting edge
“warpdrive”, making Python web application deployment magically easy.
Making the most of your Test Suite
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
Zero Downtime Deployment with Ansible
Testing Django Applications

What's hot (20)

PDF
Zero Downtime Deployment with Ansible
PDF
The Puppet Master on the JVM - PuppetConf 2014
PDF
Test Driven Development with Puppet - PuppetConf 2014
PDF
Ansible : what's ansible & use case by REX
PDF
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
PDF
Ansible Meetup Hamburg / Quickstart
PDF
Ansible Crash Course
PDF
Software development practices in python
PDF
Cookbook testing with KitcenCI and Serverrspec
PDF
Puppet: What _not_ to do
PDF
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
PPTX
Puppet camp chicago-automated_testing2
PDF
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
PDF
Ansible best practices
PDF
Introduction to Ansible (Pycon7 2016)
PPTX
Ansible presentation
PDF
10 Million hits a day with WordPress using a $15 VPS
PPTX
Puppet - an introduction
PPTX
Introduction to Ansible
PPTX
DevOps with Fabric
Zero Downtime Deployment with Ansible
The Puppet Master on the JVM - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014
Ansible : what's ansible & use case by REX
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Ansible Meetup Hamburg / Quickstart
Ansible Crash Course
Software development practices in python
Cookbook testing with KitcenCI and Serverrspec
Puppet: What _not_ to do
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Puppet camp chicago-automated_testing2
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Ansible best practices
Introduction to Ansible (Pycon7 2016)
Ansible presentation
10 Million hits a day with WordPress using a $15 VPS
Puppet - an introduction
Introduction to Ansible
DevOps with Fabric
Ad

Viewers also liked (20)

PDF
Scaling Django Apps using AWS Elastic Beanstalk
PDF
Django in heavy load environment
PDF
AWS: Scaling With Elastic Beanstalk
PDF
We Buy Cheese in a Cheese Shop
PPTX
Python, Development Environment for Windows
PDF
Python Recipes for django girls seoul
PPTX
2016 py con2016_lightingtalk_php to python
PDF
Bottle - Python Web Microframework
PPT
Html5 History-API
PDF
라이트닝 토크 2015 파이콘
PDF
Django mongodb -djangoday_
PDF
Django e il Rap Elia Contini
PDF
Django - The Web framework for perfectionists with deadlines
PDF
2007 - 应用系统脆弱性概论
PDF
Website optimization
ODP
Authentication & Authorization in ASPdotNet MVC
PDF
The Django Book, Chapter 16: django.contrib
ODP
Rabbitmq & Postgresql
PDF
EuroDjangoCon 2009 - Ein Rückblick
PDF
Django - The Web framework for perfectionists with deadlines
Scaling Django Apps using AWS Elastic Beanstalk
Django in heavy load environment
AWS: Scaling With Elastic Beanstalk
We Buy Cheese in a Cheese Shop
Python, Development Environment for Windows
Python Recipes for django girls seoul
2016 py con2016_lightingtalk_php to python
Bottle - Python Web Microframework
Html5 History-API
라이트닝 토크 2015 파이콘
Django mongodb -djangoday_
Django e il Rap Elia Contini
Django - The Web framework for perfectionists with deadlines
2007 - 应用系统脆弱性概论
Website optimization
Authentication & Authorization in ASPdotNet MVC
The Django Book, Chapter 16: django.contrib
Rabbitmq & Postgresql
EuroDjangoCon 2009 - Ein Rückblick
Django - The Web framework for perfectionists with deadlines
Ad

Similar to Django Deployment-in-AWS (20)

PDF
Multiple django applications on a single server with nginx
PDF
Two scoops of Django - Deployment
PDF
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
PDF
Batteries not included
PPTX
uWSGI - Swiss army knife for your Python web apps
PDF
Nginx3
PDF
Django dev-env-my-way
PDF
Scalable Django Architecture
PDF
From Zero to Hero @ PyGrunn 2014
PPTX
One click deployment
KEY
Django deployment with PaaS
KEY
DjangoCon recap
PDF
Free django
PDF
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
PDF
Scaling Django with gevent
PDF
Gearman - Northeast PHP 2012
PDF
PyCon India 2012: Celery Talk
PPT
Python Deployment with Fabric
PDF
Running Django on Docker: a workflow and code
PDF
NGINX: Basics and Best Practices EMEA
Multiple django applications on a single server with nginx
Two scoops of Django - Deployment
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
Batteries not included
uWSGI - Swiss army knife for your Python web apps
Nginx3
Django dev-env-my-way
Scalable Django Architecture
From Zero to Hero @ PyGrunn 2014
One click deployment
Django deployment with PaaS
DjangoCon recap
Free django
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Scaling Django with gevent
Gearman - Northeast PHP 2012
PyCon India 2012: Celery Talk
Python Deployment with Fabric
Running Django on Docker: a workflow and code
NGINX: Basics and Best Practices EMEA

More from Mindfire Solutions (20)

PDF
Physician Search and Review
PDF
diet management app
PDF
Business Technology Solution
PDF
Remote Health Monitoring
PDF
Influencer Marketing Solution
PPT
High Availability of Azure Applications
PPTX
IOT Hands On
PPTX
Glimpse of Loops Vs Set
ODP
Oracle Sql Developer-Getting Started
PPT
Adaptive Layout In iOS 8
PPT
Introduction to Auto-layout : iOS/Mac
PPT
LINQPad - utility Tool
PPT
Get started with watch kit development
PPTX
Swift vs Objective-C
ODP
Material Design in Android
ODP
Introduction to OData
PPT
Ext js Part 2- MVC
PPT
ExtJs Basic Part-1
PPT
Spring Security Introduction
Physician Search and Review
diet management app
Business Technology Solution
Remote Health Monitoring
Influencer Marketing Solution
High Availability of Azure Applications
IOT Hands On
Glimpse of Loops Vs Set
Oracle Sql Developer-Getting Started
Adaptive Layout In iOS 8
Introduction to Auto-layout : iOS/Mac
LINQPad - utility Tool
Get started with watch kit development
Swift vs Objective-C
Material Design in Android
Introduction to OData
Ext js Part 2- MVC
ExtJs Basic Part-1
Spring Security Introduction

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
System and Network Administraation Chapter 3
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Nekopoi APK 2025 free lastest update
PPTX
Introduction to Artificial Intelligence
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Essential Infomation Tech presentation.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
Transform Your Business with a Software ERP System
Which alternative to Crystal Reports is best for small or large businesses.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
System and Network Administraation Chapter 3
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Nekopoi APK 2025 free lastest update
Introduction to Artificial Intelligence
Reimagine Home Health with the Power of Agentic AI​
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Understanding Forklifts - TECH EHS Solution
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Essential Infomation Tech presentation.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms I-SECS-1021-03
VVF-Customer-Presentation2025-Ver1.9.pptx

Django Deployment-in-AWS

  • 1. Django Deployment Best Practices Presenter: Premananda Das, Mindfire Solutions Date: 05/02/2015
  • 2. About me Connect Me: Facebook: https://www.facebook.com/premanandad Linkedin: https://in.linkedin.com/pub/premananda-das/1a/353/454 Twitter: https://twitter.com/premananda Google+: https://plus.google.com/117290494758487835690 Contact Me: Email: premanandad@mindfiresolutions.com / premanandad@gmail.com Skype: mfsi_prem Zend PHP Certified and Zend Framework Certified developer. Skills: PHP, Python, Zend Framework, CodeIgniter, CakePHP, Django, JavaScript, jQuery, Mysql, Postgresql, AWS. Presenter: Premananda Das, Mindfire Solutions
  • 3. Agenda Environment setup Server configuration Tools Demo: Deploying in AWS Q&A Presenter: Premananda Das, Mindfire Solutions
  • 4. Environment setup pip Virtualenv and Virtualenvwrapper Django setup requirements.txt git Supervisord Presenter: Premananda Das, Mindfire Solutions
  • 5. Environment setup > pip Its a tool for installing Python packages from PyPI. Install: sudo apt-get install python-pip Example: $ pip install PackageName # latest version $ pip install PackageName ==1.0.4 # specific version $ pip install PackageName >=1.0.4' # minimum version $ pip uninstall PackageName Presenter: Premananda Das, Mindfire Solutions
  • 6. Environment setup > Virtualenv Presenter: Premananda Das, Mindfire Solutions A tool to create isolated Python environments. $ pip install virtualenv Example: Create Environment: $ virtualenv venv Activate Environment: $ source venv/bin/activate Install Packages: $ pip install requests Deactivate Environment: $ deactivate Virtualenvwrapper is a set of extensions to virtualenv tool. It provides commands to make it easy to work with virtualenv. Create virtual environment: mkvirtualenv mynewenv List virtual environment: lsvirtualenv Remove a virtual environment: rmvirtualenv myenv
  • 7. Environment setup > Django Presenter: Premananda Das, Mindfire Solutions Install: $ pip install django New project: $ django-admin.py startproject myproject 1. Keep the app name concise - simple and one word. 2. Use flake8 to check coding convention - PEP8. 3. django-dotenv - avoid using local_settings.py. 4. Error handling and logging: logger - error and exception with log rotate. 5. DEBUG = False. 6. DB log error and analyse slow queries. 7. django-debug-toolbar for debugging. 8. Don’t reinvent the wheel.
  • 8. Environment setup > requirements.txt Presenter: Premananda Das, Mindfire Solutions $ pip freeze > requirements.txt $ pip install -r requirements.txt
  • 9. Environment setup > git Presenter: Premananda Das, Mindfire Solutions Ubuntu: sudo apt-get install git 1. Working directory must be kept clean. 2. All files should be committed to git. 3. Server configs can be kept in git. 4. Don’t keep any application and database password in git. 5. Follow process: Gitflow Workflow
  • 10. Environment setup > git > Gitflow Workflow Presenter: Premananda Das, Mindfire Solutions
  • 11. Environment setup > Supervisord Presenter: Premananda Das, Mindfire Solutions A Process Control System Install: pip: pip install supervisor —pre Ubuntu: sudo apt-get install supervisor Config: echo_supervisord_conf > /etc/supervisord.conf $ sudo supervisorctl reload $ sudo supervisorctl restart uwsgi
  • 12. Environment setup > Supervisord Presenter: Premananda Das, Mindfire Solutions #/etc/supervisor/conf.d/uwsgi.conf [program:uwsgi] command=/home/ubuntu/.virtualenvs/venv/bin/uwsgi --ini /home/ubuntu/myproject/system/uwsgi/uwsgi.ini directory=/home/ubuntu/myproject user=www-data autostart=true autorestart=true redirect_stderr=true stopsignal=QUIT stopasgroup=true killasgroup=true
  • 13. Server configuration > Nginx > uWSGI Presenter: Premananda Das, Mindfire Solutions The world’s busiest websites use
  • 15. Server configuration > uWSGI Presenter: Premananda Das, Mindfire Solutions Install: $ pip install uwsgi Supervisord conf: [program:uwsgi] command=/home/ubuntu/.virtualenvs/venv/bin/uwsgi --ini /home/ubuntu/myproject/system/uwsgi.ini directory=/home/ubuntu/myproject user=www-data autostart=true autorestart=true redirect_stderr=true stopsignal=QUIT stopasgroup=true killasgroup=true
  • 16. Server configuration > uWSGI Presenter: Premananda Das, Mindfire Solutions [uwsgi] chdir = /home/ubuntu/myproject module = myproject.wsgi # the virtualenv (full path) home = /home/ubuntu/.virtualenvs/venv/ #logger = file:/home/ubuntu/myproject/log/uwsgi.log # process-related settings master = true # maximum number of worker processes processes = 3 # the socket (use the full path to be safe) socket = /tmp/myproject.sock chmod-socket = 666 # clear environment on exit vacuum = true
  • 17. Server configuration > Nginx Presenter: Premananda Das, Mindfire Solutions Install: sudo apt-get install nginx Process: Start: sudo service nginx start Stop: sudo service nginx stop Check Status: sudo service nginx status Restart: sudo service nginx restart Server Config: /etc/nginx/sites-enabled/web-http.conf server { listen 80; server_name myserver.com; return 301 https://$server_name$request_uri; }
  • 18. Server configuration > nginx Presenter: Premananda Das, Mindfire Solutions /etc/nginx/sites-enabled/web-https.conf server { listen 443; server_name myserver.com; root /home/ubuntu/myproject/static; client_max_body_size 4G; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ssl on; ssl_certificate /etc/nginx/ssl/certs/bundle.crt; ssl_certificate_key /etc/nginx/ssl/certs/myserver_com.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers on; Continued…
  • 19. Server configuration > nginx Presenter: Premananda Das, Mindfire Solutions location / { uwsgi_pass django; include /home/ubuntu/myproject/system/uwsgi/uwsgi_params; } location /static/ { alias /home/ubuntu/myproject/myproject/static/; } } upstream django { server unix:///tmp/guinness.sock; # for a file socket } uwsgi_params: uwsgi_param QUERY_STRING $query_string; uwsgi_param REQUEST_METHOD $request_method; uwsgi_param CONTENT_TYPE $content_type; uwsgi_param CONTENT_LENGTH $content_length; uwsgi_param REQUEST_URI $request_uri; uwsgi_param PATH_INFO $document_uri; uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param SERVER_PROTOCOL $server_protocol; uwsgi_param HTTPS $https if_not_empty; uwsgi_param REMOTE_ADDR $remote_addr; uwsgi_param REMOTE_PORT $remote_port; uwsgi_param SERVER_PORT $server_port; uwsgi_param SERVER_NAME $server_name;
  • 20. Tools Presenter: Premananda Das, Mindfire Solutions 1. New Relic: Server and application monitoring 2. Sentry: Gives insight into the application errors 3. Jenkins for CI, unittest 4. Fabric: Application deployment or system administration tasks over SSH.
  • 21. Demo > Deploying in AWS Presenter: Premananda Das, Mindfire Solutions
  • 22. Any Questions? Presenter: Premananda Das, Mindfire Solutions
  • 23. References Link Presenter: Premananda Das, Mindfire Solutions pip: https://pip.pypa.io/en/latest/reference/pip_install.html git: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow- workflow virtualenvwrapper: http://virtualenvwrapper.readthedocs.org/en/latest/ uwsgi: http://uwsgi- docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Supervisord: http://supervisord.org/installing.html nginx: http://nginx.com/ uWSGI+nginx: https://www.digitalocean.com/community/tutorials/how-to- deploy-python-wsgi-applications-using-uwsgi-web-server-with-nginx Sentry: https://getsentry.com/welcome/ New Relic: http://newrelic.com/
  • 24. Presenter: Premananda Das, Mindfire Solutions Thank You !!