Deploying a Web Application         Thierry Sans
What you need Web Host       A home for your website                A name for your website Domain Name                www...
Web Hosting
Development Server vs Production Server➡   Django provides a development server๏   Does not scale with multiple requests (...
Web Hosting Storage      How much space do you need? Bandwidth    How much traffic do you expect? Money        How much do ...
Do you want/need to manage ...                Yes       physical            No                      infrastructure?     ph...
source “The State of Web Development 2010”                  from www.webdirections.org
Dedicated Physical Server✓   Total Control๏   Maintenance of the physical infrastructure๏   Administration of the operatin...
Virtual Private Server (VPS)๏   Administration of the operating system✓   No maintenance of the physical infrastructure✓  ...
Shared Web Host✓   No administration of the operating system๏   Cost๏   Not adequate for specific needs
Choosing the Technology
Choosing an operating system               source “The State of Web Development 2010”                                 from...
Choosing a web server               source “The State of Web Development 2010”                                 from www.we...
Choosing a database               source “The State of Web Development 2010”                                 from www.webd...
The popularity of LAMP•   Linux•   Apache•   MySQL•   Perl / PHP / Pyhton
Choosing a technology•   Choosing a technology depends on                        Specific applications that your web      S...
Domain Name
Internet Top Level Names•   See List of Internet top-level domains (Wikipedia)
How to get a domain name?•   You need to buy one from a Domain Name Registrar
What about Qatar?✓   A domain name in .qa➡   See Qatar Domain Registry
Step 1 - Buy your domain name•   Can be more or less expensive
Step 2 - Configure➡   Attach an IP address (or another URL) to your domaine name
Django with Apache
The big picture                                        Server SideClient Side                       mod_wsgi              ...
Apache and Python - 3 solutions➡   How Apache runs Python code•   mod_wsgi•   FastCGI•   Mod_python (deprecated)
Apache and Python - 3 solutions➡   How Apache runs Python code•   mod_wsgi•   FastCGI•   Mod_python (deprecated)
Apache and mod_wsgi•   Apache    http://www.apache.org/•   Python WSGI adapter for Apache (mod_wsgi)    http://code.google...
django.wsgiWsgi file and permissions                tsansweb/                                            __init__.py       ...
django.wsgiWsgi file and permissions                tsansweb/                                            __init__.py       ...
Django WSGI file (Django version 1.3)                    django.wsgiimport osimport syspath = os.path.abspath(os.path.dirna...
Django WSGI file (Django version 1.3)                    django.wsgiimport osimport syspath = os.path.abspath(os.path.dirna...
Django WSGI file (Django version 1.3)                      django.wsgiimport osimport syspath = os.path.abspath(os.path.dir...
httpd.conf (Apache)                         /etc/apache2/httpd.conf....LoadModule wsgi_module    libexec/apache2/mod_wsgi....
httpd.conf (Apache)                          /etc/apache2/httpd.conf                                 path to the wsgi modu...
httpd.conf (Apache)                            /etc/apache2/httpd.conf                                  path to the wsgi m...
Django and MySQL
MySQL•   MySQL    http://www.mysql.com/
Configure Django for MySQL                                                              tsansweb/settings.py....DATABASES =...
Configure Django for MySQL                                                               tsansweb/settings.py....DATABASES ...
Upcoming SlideShare
Loading in...5
×

Deploying

694

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
694
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Deploying

    1. 1. Deploying a Web Application Thierry Sans
    2. 2. What you need Web Host A home for your website A name for your website Domain Name www.myflippylocation.com
    3. 3. Web Hosting
    4. 4. Development Server vs Production Server➡ Django provides a development server๏ Does not scale with multiple requests (high threading)✓ We need to setup a production server
    5. 5. Web Hosting Storage How much space do you need? Bandwidth How much traffic do you expect? Money How much do you want to spend daily?
    6. 6. Do you want/need to manage ... Yes physical No infrastructure? physical Yes operating No server system? Virtual Share Private Web Server Host
    7. 7. source “The State of Web Development 2010” from www.webdirections.org
    8. 8. Dedicated Physical Server✓ Total Control๏ Maintenance of the physical infrastructure๏ Administration of the operating system๏ Flexibility
    9. 9. Virtual Private Server (VPS)๏ Administration of the operating system✓ No maintenance of the physical infrastructure✓ Flexibility (pay for what you need)
    10. 10. Shared Web Host✓ No administration of the operating system๏ Cost๏ Not adequate for specific needs
    11. 11. Choosing the Technology
    12. 12. Choosing an operating system source “The State of Web Development 2010” from www.webdirections.org
    13. 13. Choosing a web server source “The State of Web Development 2010” from www.webdirections.org
    14. 14. Choosing a database source “The State of Web Development 2010” from www.webdirections.org
    15. 15. The popularity of LAMP• Linux• Apache• MySQL• Perl / PHP / Pyhton
    16. 16. Choosing a technology• Choosing a technology depends on Specific applications that your web Specific needs applications uses What you are comfortable to Security administer
    17. 17. Domain Name
    18. 18. Internet Top Level Names• See List of Internet top-level domains (Wikipedia)
    19. 19. How to get a domain name?• You need to buy one from a Domain Name Registrar
    20. 20. What about Qatar?✓ A domain name in .qa➡ See Qatar Domain Registry
    21. 21. Step 1 - Buy your domain name• Can be more or less expensive
    22. 22. Step 2 - Configure➡ Attach an IP address (or another URL) to your domaine name
    23. 23. Django with Apache
    24. 24. The big picture Server SideClient Side mod_wsgi myServlet.javaWeb Browser Database Web Server Server
    25. 25. Apache and Python - 3 solutions➡ How Apache runs Python code• mod_wsgi• FastCGI• Mod_python (deprecated)
    26. 26. Apache and Python - 3 solutions➡ How Apache runs Python code• mod_wsgi• FastCGI• Mod_python (deprecated)
    27. 27. Apache and mod_wsgi• Apache http://www.apache.org/• Python WSGI adapter for Apache (mod_wsgi) http://code.google.com/p/modwsgi/
    28. 28. django.wsgiWsgi file and permissions tsansweb/ __init__.py manage.py settings.py➡ Create a django.wsgi file urls.py tsans.db➡ Modify the permissions for Apache uploads/$ chown -R :_www tsans-web WebGallery/➡ Modify the permissions for Apache$ chmod g+w tsansweb$ chmod g+w tsansweb/tsans.db
    29. 29. django.wsgiWsgi file and permissions tsansweb/ __init__.py manage.py settings.py➡ Create a django.wsgi file urls.py tsans.db➡ Modify the permissions for Apache uploads/$ chown -R :_www tsans-web WebGallery/➡ Modify the permissions for Apache _www for Mac OS www-data for Linux$ chmod g+w tsansweb$ chmod g+w tsansweb/tsans.db
    30. 30. Django WSGI file (Django version 1.3) django.wsgiimport osimport syspath = os.path.abspath(os.path.dirname(__file__))if path not in sys.path: sys.path.append(path)path+="/tsansweb"if path not in sys.path: sys.path.append(path)os.environ[DJANGO_SETTINGS_MODULE] = tsansweb.settingsimport django.core.handlers.wsgiapplication = django.core.handlers.wsgi.WSGIHandler()
    31. 31. Django WSGI file (Django version 1.3) django.wsgiimport osimport syspath = os.path.abspath(os.path.dirname(__file__))if path not in sys.path: sys.path.append(path) Django project pathpath+="/tsansweb"if path not in sys.path: sys.path.append(path)os.environ[DJANGO_SETTINGS_MODULE] = tsansweb.settingsimport django.core.handlers.wsgiapplication = django.core.handlers.wsgi.WSGIHandler()
    32. 32. Django WSGI file (Django version 1.3) django.wsgiimport osimport syspath = os.path.abspath(os.path.dirname(__file__))if path not in sys.path: sys.path.append(path) Django project pathpath+="/tsansweb"if path not in sys.path: sys.path.append(path) Settings moduleos.environ[DJANGO_SETTINGS_MODULE] = tsansweb.settingsimport django.core.handlers.wsgiapplication = django.core.handlers.wsgi.WSGIHandler()
    33. 33. httpd.conf (Apache) /etc/apache2/httpd.conf....LoadModule wsgi_module libexec/apache2/mod_wsgi.soWSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi....
    34. 34. httpd.conf (Apache) /etc/apache2/httpd.conf path to the wsgi module....LoadModule wsgi_module libexec/apache2/mod_wsgi.soWSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi....
    35. 35. httpd.conf (Apache) /etc/apache2/httpd.conf path to the wsgi module....LoadModule wsgi_module libexec/apache2/mod_wsgi.soWSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi.... path to your wsgi file
    36. 36. Django and MySQL
    37. 37. MySQL• MySQL http://www.mysql.com/
    38. 38. Configure Django for MySQL tsansweb/settings.py....DATABASES = { default: { ENGINE: django.db.backends.mysql, USER: Django, PASSWORD: Pass4Django, HOST: , # Set to empty string for localhost. PORT: , # Set to empty string for default. }}....
    39. 39. Configure Django for MySQL tsansweb/settings.py....DATABASES = { default: { ENGINE: USER: django.db.backends.mysql, Django, MySQL user and password PASSWORD: Pass4Django, HOST: , # Set to empty string for localhost. PORT: , # Set to empty string for default. }}....

    ×