SlideShare une entreprise Scribd logo
1  sur  39
Deploying a Web Application

         Thierry Sans
What you need



 Web Host       A home for your website




                A name for your website
 Domain Name
                www.myflippylocation.com
Web Hosting
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
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?
Do you want/need to manage ...

                Yes       physical            No
                      infrastructure?




     physical                           Yes        operating   No
      server                                        system?



                                  Virtual                       Share
                                  Private                       Web
                                  Server                        Host
source “The State of Web Development 2010”
                  from www.webdirections.org
Dedicated Physical Server



✓   Total Control

๏   Maintenance of the physical infrastructure

๏   Administration of the operating system

๏   Flexibility
Virtual Private Server (VPS)




๏   Administration of the operating system

✓   No maintenance of the physical infrastructure

✓   Flexibility (pay for what you need)
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 www.webdirections.org
Choosing a web server




               source “The State of Web Development 2010”
                                 from www.webdirections.org
Choosing a database




               source “The State of Web Development 2010”
                                 from www.webdirections.org
The popularity of LAMP



•   Linux

•   Apache

•   MySQL

•   Perl / PHP / Pyhton
Choosing a technology



•   Choosing a technology depends on

                        Specific applications that your web
      Specific needs
                        applications uses
                        What you are comfortable to
      Security
                        administer
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 Side
Client Side



                       mod_wsgi


                       myServlet.java
Web Browser

                                          Database
                   Web Server              Server
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.com/p/modwsgi/
django.wsgi
Wsgi 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
django.wsgi
Wsgi 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
Django WSGI file (Django version 1.3)                    django.wsgi
import os
import sys


path = 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.settings'


import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Django WSGI file (Django version 1.3)                    django.wsgi
import os
import sys


path = os.path.abspath(os.path.dirname(__file__))
if path not in sys.path:
    sys.path.append(path)
                            Django project path
path+="/tsansweb"
if path not in sys.path:
    sys.path.append(path)


os.environ['DJANGO_SETTINGS_MODULE'] = 'tsansweb.settings'


import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Django WSGI file (Django version 1.3)                      django.wsgi
import os
import sys


path = os.path.abspath(os.path.dirname(__file__))
if path not in sys.path:
    sys.path.append(path)
                            Django project path
path+="/tsansweb"
if path not in sys.path:
    sys.path.append(path)
                                                    Settings module


os.environ['DJANGO_SETTINGS_MODULE'] = 'tsansweb.settings'


import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
httpd.conf (Apache)                         /etc/apache2/httpd.conf




....


LoadModule wsgi_module    libexec/apache2/mod_wsgi.so


WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi


....
httpd.conf (Apache)                          /etc/apache2/httpd.conf




                                 path to the wsgi module
....


LoadModule wsgi_module    libexec/apache2/mod_wsgi.so


WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi


....
httpd.conf (Apache)                            /etc/apache2/httpd.conf




                                  path to the wsgi module
....


LoadModule wsgi_module    libexec/apache2/mod_wsgi.so


WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi


....
                              path to your wsgi file
Django and MySQL
MySQL




•   MySQL

    http://www.mysql.com/
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.
      }
}

....
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.
      }
}

....

Contenu connexe

Tendances

Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
yiditushe
 
Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)
Jacob Kaplan-Moss
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
guoqing75
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
Doris Chen
 

Tendances (20)

Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
Presentation
PresentationPresentation
Presentation
 
Jsp
JspJsp
Jsp
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
A re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbaiA re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbai
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
Geotalk presentation
Geotalk presentationGeotalk presentation
Geotalk presentation
 
YouDrup_in_Drupal
YouDrup_in_DrupalYouDrup_in_Drupal
YouDrup_in_Drupal
 
RicoLiveGrid
RicoLiveGridRicoLiveGrid
RicoLiveGrid
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)Introduction To Django (Strange Loop 2011)
Introduction To Django (Strange Loop 2011)
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Even faster django
Even faster djangoEven faster django
Even faster django
 
Odoo - CMS performances optimization
Odoo - CMS performances optimizationOdoo - CMS performances optimization
Odoo - CMS performances optimization
 
YUI on the go
YUI on the goYUI on the go
YUI on the go
 
Beeline Firebase talk - Firebase event Jun 2017
Beeline Firebase talk - Firebase event Jun 2017Beeline Firebase talk - Firebase event Jun 2017
Beeline Firebase talk - Firebase event Jun 2017
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
 

Similaire à Deploying

PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
Graham Dumpleton
 
Rapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 PlatformRapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 Platform
WSO2
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
andymccurdy
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 

Similaire à Deploying (20)

“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.“warpdrive”, making Python web application deployment magically easy.
“warpdrive”, making Python web application deployment magically easy.
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Rapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 PlatformRapid Application Development with WSO2 Platform
Rapid Application Development with WSO2 Platform
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Continuous delivery w projekcie open source - Marcin Stachniuk
Continuous delivery w projekcie open source - Marcin StachniukContinuous delivery w projekcie open source - Marcin Stachniuk
Continuous delivery w projekcie open source - Marcin Stachniuk
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Django Architecture Introduction
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2Dev ninja  -> vagrant + virtualbox + chef-solo + git + ec2
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
 
Django
DjangoDjango
Django
 
Running Node.js in Production using Passenger
Running Node.js in Production using PassengerRunning Node.js in Production using Passenger
Running Node.js in Production using Passenger
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
Deployment talk dpc 13
Deployment talk dpc 13Deployment talk dpc 13
Deployment talk dpc 13
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Deploying

  • 1. Deploying a Web Application Thierry Sans
  • 2. What you need Web Host A home for your website A name for your website Domain Name www.myflippylocation.com
  • 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. 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. Do you want/need to manage ... Yes physical No infrastructure? physical Yes operating No server system? Virtual Share Private Web Server Host
  • 7. source “The State of Web Development 2010” from www.webdirections.org
  • 8. Dedicated Physical Server ✓ Total Control ๏ Maintenance of the physical infrastructure ๏ Administration of the operating system ๏ Flexibility
  • 9. Virtual Private Server (VPS) ๏ Administration of the operating system ✓ No maintenance of the physical infrastructure ✓ Flexibility (pay for what you need)
  • 10. Shared Web Host ✓ No administration of the operating system ๏ Cost ๏ Not adequate for specific needs
  • 12. Choosing an operating system source “The State of Web Development 2010” from www.webdirections.org
  • 13. Choosing a web server source “The State of Web Development 2010” from www.webdirections.org
  • 14. Choosing a database source “The State of Web Development 2010” from www.webdirections.org
  • 15. The popularity of LAMP • Linux • Apache • MySQL • Perl / PHP / Pyhton
  • 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
  • 18. Internet Top Level Names • See List of Internet top-level domains (Wikipedia)
  • 19. How to get a domain name? • You need to buy one from a Domain Name Registrar
  • 20. What about Qatar? ✓ A domain name in .qa ➡ See Qatar Domain Registry
  • 21. Step 1 - Buy your domain name • Can be more or less expensive
  • 22. Step 2 - Configure ➡ Attach an IP address (or another URL) to your domaine name
  • 24. The big picture Server Side Client Side mod_wsgi myServlet.java Web Browser Database Web Server Server
  • 25. Apache and Python - 3 solutions ➡ How Apache runs Python code • mod_wsgi • FastCGI • Mod_python (deprecated)
  • 26. Apache and Python - 3 solutions ➡ How Apache runs Python code • mod_wsgi • FastCGI • Mod_python (deprecated)
  • 27. Apache and mod_wsgi • Apache http://www.apache.org/ • Python WSGI adapter for Apache (mod_wsgi) http://code.google.com/p/modwsgi/
  • 28. django.wsgi Wsgi 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. django.wsgi Wsgi 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. Django WSGI file (Django version 1.3) django.wsgi import os import sys path = 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.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
  • 31. Django WSGI file (Django version 1.3) django.wsgi import os import sys path = os.path.abspath(os.path.dirname(__file__)) if path not in sys.path: sys.path.append(path) Django project path path+="/tsansweb" if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'tsansweb.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
  • 32. Django WSGI file (Django version 1.3) django.wsgi import os import sys path = os.path.abspath(os.path.dirname(__file__)) if path not in sys.path: sys.path.append(path) Django project path path+="/tsansweb" if path not in sys.path: sys.path.append(path) Settings module os.environ['DJANGO_SETTINGS_MODULE'] = 'tsansweb.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
  • 33. httpd.conf (Apache) /etc/apache2/httpd.conf .... LoadModule wsgi_module libexec/apache2/mod_wsgi.so WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi ....
  • 34. httpd.conf (Apache) /etc/apache2/httpd.conf path to the wsgi module .... LoadModule wsgi_module libexec/apache2/mod_wsgi.so WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi ....
  • 35. httpd.conf (Apache) /etc/apache2/httpd.conf path to the wsgi module .... LoadModule wsgi_module libexec/apache2/mod_wsgi.so WSGIScriptAlias / /Users/tsans/Sites/tsansweb.wsgi .... path to your wsgi file
  • 37. MySQL • MySQL http://www.mysql.com/
  • 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. 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. } } ....

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n