SlideShare a Scribd company logo
Django in Enterprise World

            PyCon4
          9 May, 2010

        Simone Federici
       s.federici@gmail.com
Obiettivo

Django è sulla bocca di tutti, è un full stack framework che ha
  messo una pietra di storia nel mondo python, e non solo. 

Ma perchè, in Italia, le grandi aziende per il web non riescono
 a uscire dal tunnel J2EE/JSF o, peggio, Struts?

In questo talk porto alla luce differenze sostanziali di
   approccio alle problematiche comuni di applicazioni web, e
   ad architetture più complesse Enterprise. Ma cosa significa
   Enterprise? Tutto ciò che i clienti definiscono Enterprise lo è
   veramente?

Come javista che pythonista, parlerò di cosa il mondo java
  rimprovera al mondo python e come ho scoperto che le
  accuse fanno acqua...
Agenda

• Mini Django Overview (ma dovreste già conoscerlo)

• Enterprise World
   o Multi Tiers (client, web, business, EIS)
   o Conteiners, WebServices (SOA)
   o Transactions


• Development
• Deployments
• Scalability, Accessibility, and Manageability

• Q?
Django mini overview (1)
class Reporter(models.Model):
  full_name = models.CharField(max_length=70)
  def __unicode__(self):
     return self.full_name

class Article(models.Model):
  pub_date = models.DateTimeField()
  headline = models.CharField(max_length=200)
  content = models.TextField()
  reporter = odels.ForeignKey(Reporter)

  def __unicode__(self):
    return self.headline


manage.py syncdb


from django.conf.urls.defaults import *
urlpatterns = patterns('',
   (r'^articles/(d{4})/$', 'mysite.views.year_archive'),
   (r'^articles/(d{4})/(d{2})/$', 'mysite.views.month_archive'),
   (r'^articles/(d{4})/(d{2})/(d+)/$', 'mysite.views.article_detail'), )

import models from django.contrib import admin
admin.site.register(models.Article)
Django mini overview (2)

def year_archive(request, year):
  a_list = Article.objects.filter(pub_date__year=year)
  return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list})




   {% extends "base.html" %}
{% block title %}Articles for {{ year }}{% endblock %}
{% block content %}
  <h1>Articles for {{ year }}</h1>
  {% for article in article_list %}
    <p>{{ article.headline }}</p>
    <p>By {{ article.reporter.full_name }}</p>
    <p>Published {{ article.pub_date|date:"F j, Y" }}</p>
  {% endfor %}
{% endblock %}
Django mini overview (4)

from django.forms import ModelForm
   class ArticleForm(ModelForm):
  class Meta:
    model = Article
    exclude = ('title',)

ArticleForm(request.POST).save()
ArticleForm(instance=Article.objects.get(pk=1)).save()
ArticleForm(request.POST, instance=Article.objects.get(pk=pk)).save()

<form action="/form/" method="post">
   {{ form.as_p }}
   <input type="submit" value="Submit" />
</form>
Django mini overview (4)

Authentication backends      Managing files
Middleware                   Testing Django applications
Validators                   Django’s cache framework
Commands                     Conditional View Processing
Custom model fields          Sending e-mail
Custom template tags         Internationalization and localization
Custom template filters      Pagination
Custom storage system        Serializing Django objects
PDF, CVS, JSON, XML          Django settings
Jython                       Signals
Deploying
Legacy database
Error reporting via e-mail   A lot of pluggable applications...
Initial data
                             South (Data and DDL migrations)
New Django 1.2 Features

• Model Validation

• Multi Database
Enterprise World
Defines an architecture for implementing services as
  multitier applications that deliver the scalability,
  accessibility, and manageability needed by enterprise-
  level applications.

         Distributed multitiered application model
• Web       • Presentation-oriented   • Persistence     •   DB
   o browser   o GET,                   Entities        •   Legacy
   o ajax      o HEAD,                • Session Beans   •   NO SQL
   o flash     o POST,                • Message-        •   FTP
   o flex      o PUT,                   Driven Beans    •   Remote
• GUI          o DELETE                                 •   JMS!
• Batch
            • Service-oriented (WS)
               o XML-RPC
               o SOA
               o REST
               o JSON
EE Containers
     Centralized Configuration
•   JNDI
•   Datasource e Connection Pool (DB tuning)
•   Mail Server (SMTP configuration)
•   Enterprise JavaBeans (EJB) container
•   Web container
•   Application client container
•   Applet container
Web Tier

Web Applications    Web Services
• Servlet            • XML
• Filters            • SOAPTransport
• Session Listner      Protocol
• CustomTag          • WSDL Standard
• Locale               Format
                     • UDDI and XML
• JSF (why?)           Standard Formats
                     • Attachments
                     • Authentication
Business Tier
                Local and Remote
Enterprise bean is a server-side component that encapsulates the business logic of
   an application. For several reasons, enterprise beans simplify the development
   of large, distributed applications.
 • the bean developer can concentrate on solving business problems because the
    container is responsible for system-level services such as transaction
    management and security authorization.
 • the client developer can focus on the presentation of the client. The client
    developer does not have to code the routines that implement business rules or
    access databases.
 • because enterprise beans are portable components, the application assembler
    can build new applications from existing beans.

When
• The application must be scalable
• Transactions must ensure data integrity
• The application will have a variety of clients

Type
 • Session (stateful/stateless)
 • Message-Driven
 • Asyncronous
Persistence
                  ORM
• provides an object/relational mapping
  facility to developers for managing
  relational data in applications.
  o The   query language
     Finding Entities
     Persisting Entity Instances
  o Object/relational   mapping metadata
     Entities, Multiplicity, One-to-one, One-to-many,
      Many-to-one, Many-to-many
     Cascade Deletes
Services
                Authentication
• Sucurity
  o   Initial Authentication
  o   URL Authorization
  o   Invoking Business Methods (remotly)
• Realms,Users,Groups, and Roles
  o   LDAP or DB
• SSL and Certificates
JMS
      Asynchronous Messagges
 •   Allows applications to create, send, receive, and read messages using reliable,
     asynchronous, loosely coupled communication.
 •   Messaging is a method of communication between software components or
     applications. A messaging system is a peer-to-peer facility: A messaging client
     can send messages to, and receive messages from, any other client. Each client
     connects to a messaging agent that provides facilities for creating, sending,
     receiving, and reading messages.
 •   Messaging enables distributed communication that is loosely coupled. A
     component sends a message to a destination, and the recipient can retrieve the
     message from the destination.

 • Asynchronous:
provider can deliver messages to a client as they arrive; a client does not have to
   request messages in order to receive them.
 • Reliable:
can ensure that a message is delivered once and only once. Lower levels of
   reliability are available for applications that can afford to miss messages or to
   receive duplicate messages.
Transactions
• A typical enterprise application accesses
  and stores information in one or more
  databases.
  o TransactionTimeouts
  o Updating Multiple Databases
Reset Enterprise (DEVEL)

•   Web
•   WebServices
•   Remote Invocation
•   Distribuite Task
•   Messaging
•   Pooling
•   Transaction
•   Security
Reset Enterprise (DEVEL)
          Keep It Simple Stupid
•   Web                 •   django / web2py / ecc..
•   WebServices         •   SOAPpy / jsonrcp
•   Remote Invocation   •   PyRo / RPyC
•   Distribuite Task    •   Celery / wh y prefer?
•   Messaging           •   Stomp / JMS Bridge
•   Pooling             •   What's you need?
•   Transaction         •   PEP: 249
•   Security            •   django / pattern / mind
It's python!
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Why people ask for Struts or JSF
        Programmers?
• Because they want:
    • XML programming
    • No simple URL mappings (is XML not RE)
    • @nnotations with no logic inside
    • S****d Beans with getter and setter
    • the validation written in XML
    • Some complex container to inject A->B
    • An enterprise language...
    • Easy deploy: any fool can do this!
Packaging, Distributions,
             Deployments
• egg
• setuptools
• easy_install
• mod_wsgi
• mod_python
• apache restart
Interview
    When develop an enterprise
          application?
• High number of users
• Distribuite Applications
• Transactional
• Clustering
   o High Reliability
   o Faul Tolerance
• Load Balancing (plugin)
   o Stiky sessions
Scalability, Accessibility, and
       Manageability
Scalability, Accessibility, and
       Manageability
Scalability, Accessibility, and
       Manageability
Enterprise Performance
           Management
Just an open point....

monitoring applications
in production...


  Java                    Python
     • Wily Introscope
     • Dynatrace
     • JXInsight           ?
Questions?




s.federici@gmail.com

More Related Content

PDF
Python - A Comprehensive Programming Language
TsungWei Hu
 
PPTX
Social Photos - My presentation at Microsoft Tech Day
TechMaster Vietnam
 
PPTX
Asif
Shaik Asif
 
PDF
Unit 02: Web Technologies (1/2)
DSBW 2011/2002 - Carles Farré - Barcelona Tech
 
PPTX
What's new in Exchange 2013?
Microsoft TechNet - Belgium and Luxembourg
 
PDF
Wt unit 1 ppts web development process
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
PDF
Composite Applications with SOA, BPEL and Java EE
Dmitri Shiryaev
 
PPTX
On prem vs cloud exchange
btanmdsny
 
Python - A Comprehensive Programming Language
TsungWei Hu
 
Social Photos - My presentation at Microsoft Tech Day
TechMaster Vietnam
 
Unit 02: Web Technologies (1/2)
DSBW 2011/2002 - Carles Farré - Barcelona Tech
 
What's new in Exchange 2013?
Microsoft TechNet - Belgium and Luxembourg
 
Wt unit 1 ppts web development process
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Composite Applications with SOA, BPEL and Java EE
Dmitri Shiryaev
 
On prem vs cloud exchange
btanmdsny
 

What's hot (19)

PDF
Karwin bill zf-db-zend_con-20071009
robinvnxxx
 
PDF
VA Smalltalk Update
ESUG
 
PPTX
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Gus Fraser
 
PPTX
Webinar - Interaction Dialer overview - Outbound dialing made even more power...
Avtex
 
PDF
Web Services PHP Tutorial
Lorna Mitchell
 
PDF
Wt unit 3 server side technology
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
PDF
Java EE 7 overview
Masoud Kalali
 
PDF
HTML5 Refresher
Ivano Malavolta
 
PDF
Amish Umesh - Future Of Web App Testing - ClubHack2007
ClubHack
 
PDF
Wave14 - Exchange 2010 Beta Preview by MVP Poo Ching Loong
Quek Lilian
 
PPT
Dojo - from web page to web apps
yoavrubin
 
PDF
Xedapp - Overview
Xedapp
 
PPT
Spring 3.1: a Walking Tour
Joshua Long
 
PDF
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
PPT
Microsoft Unified Communications - Introduction to Exchange Server 2010 (II) ...
Microsoft Private Cloud
 
PPT
Universal Java Beans with DB2 from 1999, early Internet work
Matthew Perrins
 
PDF
Advanced DNS/DHCP for Novell eDirectory Environments
Novell
 
PPT
Net framework
Mahfuz1061
 
PDF
JVM Multitenancy (JavaOne 2012)
Graeme_IBM
 
Karwin bill zf-db-zend_con-20071009
robinvnxxx
 
VA Smalltalk Update
ESUG
 
Building Secure Extranets with Claims-Based Authentication #SPEvo13
Gus Fraser
 
Webinar - Interaction Dialer overview - Outbound dialing made even more power...
Avtex
 
Web Services PHP Tutorial
Lorna Mitchell
 
Java EE 7 overview
Masoud Kalali
 
HTML5 Refresher
Ivano Malavolta
 
Amish Umesh - Future Of Web App Testing - ClubHack2007
ClubHack
 
Wave14 - Exchange 2010 Beta Preview by MVP Poo Ching Loong
Quek Lilian
 
Dojo - from web page to web apps
yoavrubin
 
Xedapp - Overview
Xedapp
 
Spring 3.1: a Walking Tour
Joshua Long
 
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
Microsoft Unified Communications - Introduction to Exchange Server 2010 (II) ...
Microsoft Private Cloud
 
Universal Java Beans with DB2 from 1999, early Internet work
Matthew Perrins
 
Advanced DNS/DHCP for Novell eDirectory Environments
Novell
 
Net framework
Mahfuz1061
 
JVM Multitenancy (JavaOne 2012)
Graeme_IBM
 
Ad

Viewers also liked (8)

PDF
Effective EC2
PyCon Italia
 
PDF
socket e SocketServer: il framework per i server Internet in Python
PyCon Italia
 
PDF
Undici anni di lavoro con Python
PyCon Italia
 
PDF
Spyppolare o non spyppolare
PyCon Italia
 
PDF
Qt mobile PySide bindings
PyCon Italia
 
PDF
Feed back report 2010
PyCon Italia
 
PDF
OpenERP e l'arte della gestione aziendale con Python
PyCon Italia
 
PDF
Foxgame introduzione all'apprendimento automatico
PyCon Italia
 
Effective EC2
PyCon Italia
 
socket e SocketServer: il framework per i server Internet in Python
PyCon Italia
 
Undici anni di lavoro con Python
PyCon Italia
 
Spyppolare o non spyppolare
PyCon Italia
 
Qt mobile PySide bindings
PyCon Italia
 
Feed back report 2010
PyCon Italia
 
OpenERP e l'arte della gestione aziendale con Python
PyCon Italia
 
Foxgame introduzione all'apprendimento automatico
PyCon Italia
 
Ad

Similar to Django è pronto per l'Enterprise (20)

PDF
Django in enterprise world
Simone Federici
 
ODP
Intro in JavaEE world (TU Olomouc)
blahap
 
PPT
J2 ee archi
saurabhshertukde
 
ODP
Java Web Programming [1/9] : Introduction to Web Application
IMC Institute
 
PDF
Introduction To J Boss Seam
ashishkulkarni
 
PDF
Developer’s intro to the alfresco platform
Alfresco Software
 
PDF
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Charles Moulliard
 
PPT
Enterprise Software Architecture
rahmed_sct
 
PPTX
Digging deeper into service stack
cyberzeddk
 
PPTX
Advanced Web Technology using Django.pptx
smartguykrish11
 
PPT
Virtual classroom
Krishna Chaithanya
 
PDF
Introducing Django
zerok
 
PDF
Web Application Solutions
Alexander Sergeev
 
PDF
CG_CS25010_Lecture
Connor Goddard
 
PDF
EuroPython 2011 - How to build complex web applications having fun?
Andrew Mleczko
 
PDF
Web frameworks
Valerio Maggio
 
PDF
Snakes on the Web
Jacob Kaplan-Moss
 
PDF
JBoss / Red Hat: bridging the gap between web services technologies and real ...
ecows2011
 
PDF
Rapid Web Development with Python for Absolute Beginners
Fatih Karatana
 
PPTX
AMIS OOW Review 2012 - Deel 7 - Lucas Jellema
Getting value from IoT, Integration and Data Analytics
 
Django in enterprise world
Simone Federici
 
Intro in JavaEE world (TU Olomouc)
blahap
 
J2 ee archi
saurabhshertukde
 
Java Web Programming [1/9] : Introduction to Web Application
IMC Institute
 
Introduction To J Boss Seam
ashishkulkarni
 
Developer’s intro to the alfresco platform
Alfresco Software
 
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Charles Moulliard
 
Enterprise Software Architecture
rahmed_sct
 
Digging deeper into service stack
cyberzeddk
 
Advanced Web Technology using Django.pptx
smartguykrish11
 
Virtual classroom
Krishna Chaithanya
 
Introducing Django
zerok
 
Web Application Solutions
Alexander Sergeev
 
CG_CS25010_Lecture
Connor Goddard
 
EuroPython 2011 - How to build complex web applications having fun?
Andrew Mleczko
 
Web frameworks
Valerio Maggio
 
Snakes on the Web
Jacob Kaplan-Moss
 
JBoss / Red Hat: bridging the gap between web services technologies and real ...
ecows2011
 
Rapid Web Development with Python for Absolute Beginners
Fatih Karatana
 
AMIS OOW Review 2012 - Deel 7 - Lucas Jellema
Getting value from IoT, Integration and Data Analytics
 

More from PyCon Italia (12)

PDF
zc.buildout: "Un modo estremamente civile per sviluppare un'applicazione"
PyCon Italia
 
PDF
Python: ottimizzazione numerica algoritmi genetici
PyCon Italia
 
PDF
Python idiomatico
PyCon Italia
 
PDF
Python in the browser
PyCon Italia
 
PDF
PyPy 1.2: snakes never crawled so fast
PyCon Italia
 
PDF
PyCuda: Come sfruttare la potenza delle schede video nelle applicazioni python
PyCon Italia
 
PDF
New and improved: Coming changes to the unittest module
PyCon Italia
 
PDF
Monitoraggio del Traffico di Rete Usando Python ed ntop
PyCon Italia
 
PDF
Jython for embedded software validation
PyCon Italia
 
PDF
Crogioli, alambicchi e beute: dove mettere i vostri dati.
PyCon Italia
 
PDF
Comet web applications with Python, Django & Orbited
PyCon Italia
 
ZIP
Cleanup and new optimizations in WPython 1.1
PyCon Italia
 
zc.buildout: "Un modo estremamente civile per sviluppare un'applicazione"
PyCon Italia
 
Python: ottimizzazione numerica algoritmi genetici
PyCon Italia
 
Python idiomatico
PyCon Italia
 
Python in the browser
PyCon Italia
 
PyPy 1.2: snakes never crawled so fast
PyCon Italia
 
PyCuda: Come sfruttare la potenza delle schede video nelle applicazioni python
PyCon Italia
 
New and improved: Coming changes to the unittest module
PyCon Italia
 
Monitoraggio del Traffico di Rete Usando Python ed ntop
PyCon Italia
 
Jython for embedded software validation
PyCon Italia
 
Crogioli, alambicchi e beute: dove mettere i vostri dati.
PyCon Italia
 
Comet web applications with Python, Django & Orbited
PyCon Italia
 
Cleanup and new optimizations in WPython 1.1
PyCon Italia
 

Recently uploaded (20)

PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
The Future of Artificial Intelligence (AI)
Mukul
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Software Development Methodologies in 2025
KodekX
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 

Django è pronto per l'Enterprise

  • 1. Django in Enterprise World PyCon4 9 May, 2010 Simone Federici [email protected]
  • 2. Obiettivo Django è sulla bocca di tutti, è un full stack framework che ha messo una pietra di storia nel mondo python, e non solo.  Ma perchè, in Italia, le grandi aziende per il web non riescono a uscire dal tunnel J2EE/JSF o, peggio, Struts? In questo talk porto alla luce differenze sostanziali di approccio alle problematiche comuni di applicazioni web, e ad architetture più complesse Enterprise. Ma cosa significa Enterprise? Tutto ciò che i clienti definiscono Enterprise lo è veramente? Come javista che pythonista, parlerò di cosa il mondo java rimprovera al mondo python e come ho scoperto che le accuse fanno acqua...
  • 3. Agenda • Mini Django Overview (ma dovreste già conoscerlo) • Enterprise World o Multi Tiers (client, web, business, EIS) o Conteiners, WebServices (SOA) o Transactions • Development • Deployments • Scalability, Accessibility, and Manageability • Q?
  • 4. Django mini overview (1) class Reporter(models.Model): full_name = models.CharField(max_length=70) def __unicode__(self): return self.full_name class Article(models.Model): pub_date = models.DateTimeField() headline = models.CharField(max_length=200) content = models.TextField() reporter = odels.ForeignKey(Reporter) def __unicode__(self): return self.headline manage.py syncdb from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^articles/(d{4})/$', 'mysite.views.year_archive'), (r'^articles/(d{4})/(d{2})/$', 'mysite.views.month_archive'), (r'^articles/(d{4})/(d{2})/(d+)/$', 'mysite.views.article_detail'), ) import models from django.contrib import admin admin.site.register(models.Article)
  • 5. Django mini overview (2) def year_archive(request, year): a_list = Article.objects.filter(pub_date__year=year) return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list}) {% extends "base.html" %} {% block title %}Articles for {{ year }}{% endblock %} {% block content %} <h1>Articles for {{ year }}</h1> {% for article in article_list %} <p>{{ article.headline }}</p> <p>By {{ article.reporter.full_name }}</p> <p>Published {{ article.pub_date|date:"F j, Y" }}</p> {% endfor %} {% endblock %}
  • 6. Django mini overview (4) from django.forms import ModelForm class ArticleForm(ModelForm): class Meta: model = Article exclude = ('title',) ArticleForm(request.POST).save() ArticleForm(instance=Article.objects.get(pk=1)).save() ArticleForm(request.POST, instance=Article.objects.get(pk=pk)).save() <form action="/form/" method="post"> {{ form.as_p }} <input type="submit" value="Submit" /> </form>
  • 7. Django mini overview (4) Authentication backends Managing files Middleware Testing Django applications Validators Django’s cache framework Commands Conditional View Processing Custom model fields Sending e-mail Custom template tags Internationalization and localization Custom template filters Pagination Custom storage system Serializing Django objects PDF, CVS, JSON, XML Django settings Jython Signals Deploying Legacy database Error reporting via e-mail A lot of pluggable applications... Initial data South (Data and DDL migrations)
  • 8. New Django 1.2 Features • Model Validation • Multi Database
  • 9. Enterprise World Defines an architecture for implementing services as multitier applications that deliver the scalability, accessibility, and manageability needed by enterprise- level applications. Distributed multitiered application model
  • 10. • Web • Presentation-oriented • Persistence • DB o browser o GET, Entities • Legacy o ajax o HEAD, • Session Beans • NO SQL o flash o POST, • Message- • FTP o flex o PUT, Driven Beans • Remote • GUI o DELETE • JMS! • Batch • Service-oriented (WS) o XML-RPC o SOA o REST o JSON
  • 11. EE Containers Centralized Configuration • JNDI • Datasource e Connection Pool (DB tuning) • Mail Server (SMTP configuration) • Enterprise JavaBeans (EJB) container • Web container • Application client container • Applet container
  • 12. Web Tier Web Applications Web Services • Servlet • XML • Filters • SOAPTransport • Session Listner Protocol • CustomTag • WSDL Standard • Locale Format • UDDI and XML • JSF (why?) Standard Formats • Attachments • Authentication
  • 13. Business Tier Local and Remote Enterprise bean is a server-side component that encapsulates the business logic of an application. For several reasons, enterprise beans simplify the development of large, distributed applications. • the bean developer can concentrate on solving business problems because the container is responsible for system-level services such as transaction management and security authorization. • the client developer can focus on the presentation of the client. The client developer does not have to code the routines that implement business rules or access databases. • because enterprise beans are portable components, the application assembler can build new applications from existing beans. When • The application must be scalable • Transactions must ensure data integrity • The application will have a variety of clients Type • Session (stateful/stateless) • Message-Driven • Asyncronous
  • 14. Persistence ORM • provides an object/relational mapping facility to developers for managing relational data in applications. o The query language  Finding Entities  Persisting Entity Instances o Object/relational mapping metadata  Entities, Multiplicity, One-to-one, One-to-many, Many-to-one, Many-to-many  Cascade Deletes
  • 15. Services Authentication • Sucurity o Initial Authentication o URL Authorization o Invoking Business Methods (remotly) • Realms,Users,Groups, and Roles o LDAP or DB • SSL and Certificates
  • 16. JMS Asynchronous Messagges • Allows applications to create, send, receive, and read messages using reliable, asynchronous, loosely coupled communication. • Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: A messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, receiving, and reading messages. • Messaging enables distributed communication that is loosely coupled. A component sends a message to a destination, and the recipient can retrieve the message from the destination. • Asynchronous: provider can deliver messages to a client as they arrive; a client does not have to request messages in order to receive them. • Reliable: can ensure that a message is delivered once and only once. Lower levels of reliability are available for applications that can afford to miss messages or to receive duplicate messages.
  • 17. Transactions • A typical enterprise application accesses and stores information in one or more databases. o TransactionTimeouts o Updating Multiple Databases
  • 18. Reset Enterprise (DEVEL) • Web • WebServices • Remote Invocation • Distribuite Task • Messaging • Pooling • Transaction • Security
  • 19. Reset Enterprise (DEVEL) Keep It Simple Stupid • Web • django / web2py / ecc.. • WebServices • SOAPpy / jsonrcp • Remote Invocation • PyRo / RPyC • Distribuite Task • Celery / wh y prefer? • Messaging • Stomp / JMS Bridge • Pooling • What's you need? • Transaction • PEP: 249 • Security • django / pattern / mind
  • 20. It's python! >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
  • 21. Why people ask for Struts or JSF Programmers? • Because they want: • XML programming • No simple URL mappings (is XML not RE) • @nnotations with no logic inside • S****d Beans with getter and setter • the validation written in XML • Some complex container to inject A->B • An enterprise language... • Easy deploy: any fool can do this!
  • 22. Packaging, Distributions, Deployments • egg • setuptools • easy_install • mod_wsgi • mod_python • apache restart
  • 23. Interview When develop an enterprise application? • High number of users • Distribuite Applications • Transactional • Clustering o High Reliability o Faul Tolerance • Load Balancing (plugin) o Stiky sessions
  • 27. Enterprise Performance Management Just an open point.... monitoring applications in production... Java Python • Wily Introscope • Dynatrace • JXInsight ?