ploneconf2011 - how to build erp application while having fun

109
How t o b ui l d c omple x web appl ic a ti ons ha vi n g fu n ? How t o b ui l d c omple x web appl ic a ti ons ha vi n g fu n ? How to build complex web applications having fun ?

Upload: andrew-mleczko

Post on 21-May-2015

3.836 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: PloneConf2011 - How to build ERP application while having fun

How to build complex

web applications having fun?

How to build complex

web applications having fun?

How to build complex

web applications having fun?

Page 2: PloneConf2011 - How to build ERP application while having fun

How to build complex

web applications having fun?

How to build complex

web applications having fun?

How to build complex

web applications having fun?

Page 6: PloneConf2011 - How to build ERP application while having fun

the team

Page 7: PloneConf2011 - How to build ERP application while having fun

the team

Page 8: PloneConf2011 - How to build ERP application while having fun

WHY this talk?

Page 9: PloneConf2011 - How to build ERP application while having fun

My Reasons to be here

★ Building complex web

applications should

be fun

★ to promote

Page 10: PloneConf2011 - How to build ERP application while having fun
Page 11: PloneConf2011 - How to build ERP application while having fun
Page 12: PloneConf2011 - How to build ERP application while having fun

SMALL “Roughly 5000 lines of code”

Page 13: PloneConf2011 - How to build ERP application while having fun

SMALL

FAST

“Roughly 5000 lines of code”

Page 14: PloneConf2011 - How to build ERP application while having fun

SMALL

FAST

STABLE

“Roughly 5000 lines of code”

Page 15: PloneConf2011 - How to build ERP application while having fun

SMALL

TESTED

FAST

STABLE

“Roughly 5000 lines of code”

“100% statement coverage via unit and

integration tests”

Page 16: PloneConf2011 - How to build ERP application while having fun

SMALL

DOCUMENTED

TESTED

FAST

STABLE

“Roughly 5000 lines of code”

“100% statement coverage via unit and

integration tests”

“Literally nothingin Pyramid

is undocumented”

Page 17: PloneConf2011 - How to build ERP application while having fun

★ Debug Toolbar

★ Flexible authentication

and authorization

★ Tweens - a bit like WSGI

middleware

Page 18: PloneConf2011 - How to build ERP application while having fun

★ Decorator-based configuration

from pyramid.view import view_configfrom pyramid.response import Response

@view_config(route_name='fred')def fred_view(request): return Response('fred')

Page 19: PloneConf2011 - How to build ERP application while having fun

★ Event system (based on ZCA)

from pyramid.events import NewRequestfrom pyramid.events import subscriber

@subscriber(NewRequest)def mysubscriber(event): event.request.foo = 1

Page 20: PloneConf2011 - How to build ERP application while having fun

★ Extendable configuration

from pyramid.config import Configurator

if __name__ == '__main__': config = Configurator() config.include('pyramid_formalchemy')

Page 21: PloneConf2011 - How to build ERP application while having fun

the project

Page 22: PloneConf2011 - How to build ERP application while having fun

The Customer

★ .

★ Born as a startup

★ Offices in US

Page 23: PloneConf2011 - How to build ERP application while having fun

Water today

★ U.S. - the largest consumer market

for bottled water in the world

★ in 2011, the market is forecast to have

a value of $86,421.2 billion

“Bottled water has become the second largest commercial beverage category”

Page 24: PloneConf2011 - How to build ERP application while having fun
Page 25: PloneConf2011 - How to build ERP application while having fun
Page 26: PloneConf2011 - How to build ERP application while having fun

project requirements

Page 27: PloneConf2011 - How to build ERP application while having fun
Page 28: PloneConf2011 - How to build ERP application while having fun

paperless sale

Page 29: PloneConf2011 - How to build ERP application while having fun

paperless sale

CRM

Sales

1 2 3 4 5

Warehouse

E-commerce

Support

Page 30: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

Page 31: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

Page 32: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

★ Customer’s management (satisfaction, order status, etc.)

★ Reports (machine statistics, etc.)

★ Campaigns

Page 33: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

★ Sales network management

★ Invoicing / accountancy

★ Revenue counter

★ Discount management

Page 34: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

★ Catalog management

★ Warehouse management

★ Logistic tracking

Page 35: PloneConf2011 - How to build ERP application while having fun

★ Online shop (for beverages and accessories)

★ Machine configurator (interactive wizard)

★ Online payments

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

Page 36: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

★ Machine maintenance (filter change)

★ Emergency services

★ Order / installation process

Page 37: PloneConf2011 - How to build ERP application while having fun

paperless saleCRM

Sales

1

2

3

4

5

Warehouse

E-commerce

Support

★ Machine maintenance (filter change)

★ Emergency services

★ Order / installation process

Page 38: PloneConf2011 - How to build ERP application while having fun

Support

CRM

Sales

Warehouse

E-commerce

paperless sale

Page 39: PloneConf2011 - How to build ERP application while having fun

Support

CRM

Sales

Warehouse

E-commerce

Intranet Extranet

paperless sale

Page 40: PloneConf2011 - How to build ERP application while having fun

Totally paperless ERP

Page 41: PloneConf2011 - How to build ERP application while having fun

project gotchas

Page 42: PloneConf2011 - How to build ERP application while having fun

project gotchas

★ Requirements are not rock

solid (it’s a startup) - project will

grow with the customer

★ Customer is in U.S. - planning

regular meetings is essential

★ We need to find new framework

for ERP part

★ Only 5 months to delivery

Page 43: PloneConf2011 - How to build ERP application while having fun

Arch i tectural dec i s ions

Page 44: PloneConf2011 - How to build ERP application while having fun

a n d

Page 45: PloneConf2011 - How to build ERP application while having fun

a n d

Page 46: PloneConf2011 - How to build ERP application while having fun
Page 47: PloneConf2011 - How to build ERP application while having fun

★ architecture is not so far

away from Zope

★ it supports SQLAlchemy

out of the box

★ great documentation and

active community

★ add’s some fresh air to your

architecture

why ?

Page 48: PloneConf2011 - How to build ERP application while having fun

★ pyramid_formalchemy CRUD

★ easy pluggable widgets

★ Multi-upload

★ Metric units

★ Autocomplete

★ Multi-relation

★ 75% jQuery code

why ?

Page 49: PloneConf2011 - How to build ERP application while having fun

★ pyramid_formalchemy CRUD

★ easy pluggable widgets

★ Multi-upload

★ Metric units

★ Autocomplete

★ Multi-relation

★ 75% jQuery code

why ?

Page 50: PloneConf2011 - How to build ERP application while having fun

★ pyramid_formalchemy CRUD

★ easy pluggable widgets

★ Multi-upload

★ Metric units

★ Autocomplete

★ Multi-relation

★ 75% jQuery code

why ?

Page 51: PloneConf2011 - How to build ERP application while having fun

and ?

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

Page 52: PloneConf2011 - How to build ERP application while having fun

★ Diazo (plone.app.theming)

and ?

★ Poi

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

★ PAS (PluggableAuthService)

Page 53: PloneConf2011 - How to build ERP application while having fun

★ Diazo (plone.app.theming)

and ?

★ Poi

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

★ PAS (PluggableAuthService)

Page 54: PloneConf2011 - How to build ERP application while having fun

★ Poi

★ Diazo (plone.app.theming)

and ?

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

★ PAS (PluggableAuthService)

Page 55: PloneConf2011 - How to build ERP application while having fun

★ Poi

★ Diazo (plone.app.theming)

and ?

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

★ PAS (PluggableAuthService)

Page 56: PloneConf2011 - How to build ERP application while having fun

★ Poi

★ Diazo (plone.app.theming)

and ?

★ The Best CMS ever

★ easy to integrate with

other Python frameworks

★ almost 2000 addons

★ PAS (PluggableAuthService)

Page 57: PloneConf2011 - How to build ERP application while having fun

Integrat ion

Page 58: PloneConf2011 - How to build ERP application while having fun

SQ LA l c hemy

Page 59: PloneConf2011 - How to build ERP application while having fun

PostgreSQL

aeterna.models

SQ LA l c hemy

Page 60: PloneConf2011 - How to build ERP application while having fun

au then t i c a t ion - au thor iza t ion

Page 61: PloneConf2011 - How to build ERP application while having fun

auth storage

au then t i c a t ion - au thor iza t ionR

equ

est

PostgreSQL

repoze.who

pas.plugins.sa

Page 62: PloneConf2011 - How to build ERP application while having fun

auth storage

au then t i c a t ion - au thor iza t ion

★ users

★ groups

★ roles

PostgreSQL

Page 63: PloneConf2011 - How to build ERP application while having fun

auth storage

au then t i c a t ion - au thor iza t ion

★ users

★ groups

★ roles

PostgreSQL

single-sign-on

★ plone.session

★ repoze.who.plugins.auth_tkt

mod_auth_tkt

Page 64: PloneConf2011 - How to build ERP application while having fun

bu i l dout

[intranet-plone]

recipe = plone.recipe.zope2instance

eggs =

${intranet-plone:eggs} aeterna.models

[intranet-pyramid]

recipe = zc.recipe.egg

eggs =

${intranet-pyramid:eggs} aeterna.models

Page 65: PloneConf2011 - How to build ERP application while having fun

T he b ig p i c ture

PostgreSQL

ZODB

Ap

ach

e

repoze.who

pas.plugins.sa

beaker

Page 66: PloneConf2011 - How to build ERP application while having fun

intranetextranet

T he b ig p i c ture

PostgreSQL

ZODB

Ap

ach

e

repoze.who

pas.plugins.sa

beaker

Page 67: PloneConf2011 - How to build ERP application while having fun

why not other compet i tors?

Page 68: PloneConf2011 - How to build ERP application while having fun

django: no!★ less code more magic

★ not so flexible

(specification is growing)

★ using SQLAlchemy within

could be tricky

Page 69: PloneConf2011 - How to build ERP application while having fun

drupal : no!★ security problems

(370 CVE entries)

★ integration is more difficult

(PHP vs. Python)

★ missing features

workflow, complex ACL, etc.

Page 70: PloneConf2011 - How to build ERP application while having fun

openerp : no!★ quite complex: CRM, sales,

accounting and much more

★ not enough time

to fully investigate it

★ not a generic framework

Page 71: PloneConf2011 - How to build ERP application while having fun

results

Page 72: PloneConf2011 - How to build ERP application while having fun
Page 73: PloneConf2011 - How to build ERP application while having fun
Page 74: PloneConf2011 - How to build ERP application while having fun
Page 75: PloneConf2011 - How to build ERP application while having fun
Page 76: PloneConf2011 - How to build ERP application while having fun
Page 77: PloneConf2011 - How to build ERP application while having fun
Page 78: PloneConf2011 - How to build ERP application while having fun
Page 79: PloneConf2011 - How to build ERP application while having fun
Page 80: PloneConf2011 - How to build ERP application while having fun
Page 81: PloneConf2011 - How to build ERP application while having fun
Page 82: PloneConf2011 - How to build ERP application while having fun
Page 83: PloneConf2011 - How to build ERP application while having fun
Page 84: PloneConf2011 - How to build ERP application while having fun
Page 85: PloneConf2011 - How to build ERP application while having fun
Page 86: PloneConf2011 - How to build ERP application while having fun
Page 87: PloneConf2011 - How to build ERP application while having fun

What matters?

Page 88: PloneConf2011 - How to build ERP application while having fun

Proper Tools

Page 89: PloneConf2011 - How to build ERP application while having fun

and a good team

Page 90: PloneConf2011 - How to build ERP application while having fun

★ Prototyping - it’s always a

lot of fun, but...

★ be aware of The

Learning Curve Effect

★ Collecting specification and

keeping docs up-to-date

(a real on-going process)

Page 91: PloneConf2011 - How to build ERP application while having fun

check this out!

Page 92: PloneConf2011 - How to build ERP application while having fun

pyramid_formalchemy

★ started by gawel (Gaël Pasgrimaud)

and supported by

★ using SQLAlchemy,

Formalchemy and fanstatic

★ available on pypi more then 1720 downloads so far

Page 93: PloneConf2011 - How to build ERP application while having fun

pyramid_formalchemy

★ Lots of improvements during

by

★ events hooks

★ view and action customizations

★ i18n support

★ paster templates

★ fanstatic integration

Page 94: PloneConf2011 - How to build ERP application while having fun

★ Minimal configuration:

pyramid_formalchemy

Page 95: PloneConf2011 - How to build ERP application while having fun

def main(global_config, **settings):

engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings)

# pyramid_formalchemy's configuration config.include('pyramid_formalchemy')

# register an admin UI config.formalchemy_admin('/admin', package='pyramidapp')

return config.make_wsgi_app()

★ Minimal configuration:

pyramid_formalchemy

Page 96: PloneConf2011 - How to build ERP application while having fun

★ Events subscriptions:

pyramid_formalchemy

Page 97: PloneConf2011 - How to build ERP application while having fun

@events.subscriber([User, events.IBeforeEditRenderEvent])def before_user_edit(context, event):

fs = event.kwargs['fs']

# add roles_manage field for manager: if not has_permission('manage', event.request): fs.append(fs.roles_manage) # set TinyMCE as a renderer for biography field: fs.biography.set(renderer=tinymce)

★ Events subscriptions:

pyramid_formalchemy

Page 98: PloneConf2011 - How to build ERP application while having fun

pyramid_formalchemy

★ demohttp://docs.formalchemy.org/demo/admin

★ documentationhttp://docs.formalchemy.org/pyramid_formalchemy

★ downloadhttp://pypi.python.org/pypi/pyramid_formalchemy

Page 99: PloneConf2011 - How to build ERP application while having fun

pyramid_formalchemy

★ demohttp://docs.formalchemy.org/demo/admin

★ documentationhttp://docs.formalchemy.org/pyramid_formalchemy

★ downloadhttp://pypi.python.org/pypi/pyramid_formalchemy

Page 100: PloneConf2011 - How to build ERP application while having fun

★ a pyramid_formalchemy plugin

★ based on twitter bootstrap

★ integrated with fanstatic

★ released on pypi

http://pypi.python.org/pypi/fa.bootstrap

fa.bootstrap

Page 101: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 102: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 103: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 104: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 105: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 106: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 107: PloneConf2011 - How to build ERP application while having fun

fa.bootstrap

Page 108: PloneConf2011 - How to build ERP application while having fun

Quest ions?