SlideShare une entreprise Scribd logo
1  sur  25
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

Contenu connexe

Tendances

Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014The Puppet Master on the JVM - PuppetConf 2014
The Puppet Master on the JVM - PuppetConf 2014Puppet
 
Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014Test Driven Development with Puppet - PuppetConf 2014
Test Driven Development with Puppet - PuppetConf 2014Puppet
 
Ansible : what's ansible & use case by REX
Ansible :  what's ansible & use case by REXAnsible :  what's ansible & use case by REX
Ansible : what's ansible & use case by REXSaewoong Lee
 
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Puppet
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartHenry Stamerjohann
 
Software development practices in python
Software development practices in pythonSoftware development practices in python
Software development practices in pythonJimmy Lai
 
Cookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecCookbook testing with KitcenCI and Serverrspec
Cookbook testing with KitcenCI and ServerrspecDaniel Paulus
 
Puppet: What _not_ to do
Puppet: What _not_ to doPuppet: What _not_ to do
Puppet: What _not_ to doPuppet
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2Puppet camp chicago-automated_testing2
Puppet camp chicago-automated_testing2nottings
 
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet
 
Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)Introduction to Ansible (Pycon7 2016)
Introduction to Ansible (Pycon7 2016)Ivan Rossi
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPSPaolo Tonin
 
Introduction to Ansible
Introduction to AnsibleIntroduction to Ansible
Introduction to AnsibleCoreStack
 

Tendances (20)

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

En vedette

Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkLushen Wu
 
Django in heavy load environment
Django in heavy load environmentDjango in heavy load environment
Django in heavy load environmentAndy Dai
 
AWS: Scaling With Elastic Beanstalk
AWS: Scaling With Elastic BeanstalkAWS: Scaling With Elastic Beanstalk
AWS: Scaling With Elastic BeanstalkKMS Technology
 
We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopWe Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese ShopTzu-ping Chung
 
Python, Development Environment for Windows
Python, Development Environment for WindowsPython, Development Environment for Windows
Python, Development Environment for WindowsKwangyoun Jung
 
Python Recipes for django girls seoul
Python Recipes for django girls seoulPython Recipes for django girls seoul
Python Recipes for django girls seoulJoeun Park
 
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to pythonJiho Lee
 
라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘라이트닝 토크 2015 파이콘
라이트닝 토크 2015 파이콘Jiho Lee
 
Django mongodb -djangoday_
Django mongodb -djangoday_Django mongodb -djangoday_
Django mongodb -djangoday_WEBdeBS
 
Django e il Rap Elia Contini
Django e il Rap Elia ContiniDjango e il Rap Elia Contini
Django e il Rap Elia ContiniWEBdeBS
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework  for perfectionists with deadlinesDjango - The Web framework  for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesMarkus Zapke-Gründemann
 
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论 Na Lee
 
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCAuthentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVCMindfire Solutions
 
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribThe Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contribTzu-ping Chung
 
Rabbitmq & Postgresql
Rabbitmq & PostgresqlRabbitmq & Postgresql
Rabbitmq & PostgresqlLucio Grenzi
 
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesDjango - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlinesMarkus Zapke-Gründemann
 

En vedette (20)

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

Similaire à Django Deployment-in-AWS

Null bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationAnant Shrivastava
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansibleandrewmirskynet
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and MaintenanceJazkarta, Inc.
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IOded Sagir
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from githubAntony Gitomeh
 
Xdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP codeXdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP codeAdam Englander
 
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGMarcus Sá
 
Ubuntu And Parental Controls
Ubuntu And Parental ControlsUbuntu And Parental Controls
Ubuntu And Parental Controlsjasonholtzapple
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialWidoyo PH
 
Betabeers Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platformBetabeers   Android as a Digital Signage platform
Betabeers Android as a Digital Signage platformOrestes Carracedo
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project ManagementWidoyo PH
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04SANTIAGO HERNÁNDEZ
 
Marek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with BuildoutMarek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with Buildoutmarekkuziel
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019Anam Ahmed
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with PuppetJoe Ray
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios
 
Linux for programmers
Linux for programmersLinux for programmers
Linux for programmersMd. Al Amin
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Simon Boulet
 

Similaire à Django Deployment-in-AWS (20)

Null bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web Application
 
Deploying Django with Ansible
Deploying Django with AnsibleDeploying Django with Ansible
Deploying Django with Ansible
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
Xdebug
XdebugXdebug
Xdebug
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 
Xdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP codeXdebug - Your first, last, and best option for troubleshooting PHP code
Xdebug - Your first, last, and best option for troubleshooting PHP code
 
Download It
Download ItDownload It
Download It
 
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PGSpeed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
 
Ubuntu And Parental Controls
Ubuntu And Parental ControlsUbuntu And Parental Controls
Ubuntu And Parental Controls
 
Easy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & MercurialEasy Web Project Development & Management with Django & Mercurial
Easy Web Project Development & Management with Django & Mercurial
 
Betabeers Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platformBetabeers   Android as a Digital Signage platform
Betabeers Android as a Digital Signage platform
 
Software Project Management
Software Project ManagementSoftware Project Management
Software Project Management
 
Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04Tested install-isp config3-ubuntu-16-04
Tested install-isp config3-ubuntu-16-04
 
Marek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with BuildoutMarek Kuziel - Deploying Django with Buildout
Marek Kuziel - Deploying Django with Buildout
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios CoreNagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
Nagios Conference 2014 - Eric Mislivec - Getting Started With Nagios Core
 
Linux for programmers
Linux for programmersLinux for programmers
Linux for programmers
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 

Plus de Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Dernier (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

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 !!