SlideShare a Scribd company logo
1 of 98
Download to read offline
Large Problems
                                 Mostly Solved



                                              Eric Holscher
                                   http://ericholscher.com
                                          Djangocon 2010

Wednesday, September 8, 2010
What this talk isn’t



                 » In depth
                 » Overly technical
                 » Conclusive




Wednesday, September 8, 2010
What this talk is



                 » Providing current best-of-class
                   solutions to common problems
                 » Identifying problems that aren’t
                   currently solved well




Wednesday, September 8, 2010
Overview



                 » Patterns among good apps
                 » The problems that are mostly solved
                 » Unsolved Problems




Wednesday, September 8, 2010
A good application




Wednesday, September 8, 2010
Leverages previous
                                knowledge/APIs




Wednesday, September 8, 2010
Easy Setup




Wednesday, September 8, 2010
Good upgrade path




Wednesday, September 8, 2010
Good documentation




Wednesday, September 8, 2010
Well Tested




Wednesday, September 8, 2010
Solves a real problem




Wednesday, September 8, 2010
Mostly Solved Problems




Wednesday, September 8, 2010
Search




Wednesday, September 8, 2010
Haystack


                 » 9782 lines of docs
                 » 8882 lines of tests
                 » http://haystacksearch.org/
                 » Written by Daniel Lindsley



Wednesday, September 8, 2010
Line counts


            find . |egrep "rst|txt" |xargs wc -l |cut -c1-8 |
            awk '{s+=$1} END {print s}'

            find . |egrep "py" |xargs wc -l |cut -c1-8 | awk
            '{s+=$1} END {print s}'

            #FORE!



Wednesday, September 8, 2010
Setup
                        » pip install django-haystack
                        » Add ‘haystack’ to Installed Apps
                        » Settings for siteconf and backend
                        » Create Search Site
                        » Create Search Indexes
                        » Add views
                        » Reindex
Wednesday, September 8, 2010
Upgrade Path



                 » Simple backend
                 » Whoosh
                 » Solr




Wednesday, September 8, 2010
Beautiful APIs



            unfriendly_results = SearchQuerySet().exclude
            (content='hello').filter(content='world')

            unfriendly_results.order_by('-pub_date')[:5]




Wednesday, September 8, 2010
Beautiful APIs


            class NoteIndex(SearchIndex):
               text = CharField(document=True, use_template=True)
               author = CharField(model_attr='user')
               pub_date = DateTimeField(model_attr='pub_date')

               def get_queryset(self):
                 return Note.objects.filter
            (pub_date__lte=datetime.datetime.now())




Wednesday, September 8, 2010
Awesome Features


                 » Faceting
                 » Highlighting
                 » More Like This
                 » Easy Customization




Wednesday, September 8, 2010
Wednesday, September 8, 2010
Amazing full-text search




Wednesday, September 8, 2010
In an hour.




Wednesday, September 8, 2010
Documentation




Wednesday, September 8, 2010
Sphinx


                 » 16598 lines of docs
                 » 13272 lines of tests
                 » http://sphinx.pocoo.org/
                 » Written by Georg Brandl




Wednesday, September 8, 2010
Setup


                 » pip install Sphinx
                 » sphinx-quickstart
                 » Edit/Create Restructured Text files
                 » make html




Wednesday, September 8, 2010
Awesome features


                 » Uses ReStructuredText
                 » Easily generate PDFs
                 » Link between your own and other
                   docs
                 » Themes



Wednesday, September 8, 2010
Shameless Self Promotion

                 » Use Read The Docs
                 » Host Sphinx docs, or create them
                   there.
                 » http://rtfd.org
                 » http://media.readthedocs.org/
                   django.pdf


Wednesday, September 8, 2010
Wednesday, September 8, 2010
Make Beautiful
 Documentation With Tools
       You Know

Wednesday, September 8, 2010
Database Migrations




Wednesday, September 8, 2010
South


                 » 5662 lines of docs
                 » 4328 lines of tests
                 » http://south.aeracode.org/
                 » Written by Andrew Godwin



Wednesday, September 8, 2010
Setup

                        » pip install south

                        » south in Installed Apps

                        » manage.py schemamigration app --
                          initial
                        » manage.py schemamigratoin app
                          name --auto
                        » manage.py migrate


Wednesday, September 8, 2010
Beautiful API



            def forwards(self, orm):
              for adopter in orm.Adopter.objects.all():
                 try:
                    adopter.first_name, adopter.last_name = adopter.name.split()
                 except ValueError:
                    adopter.first_name, adopter.last_name = adopter.name, ""
                 adopter.save()




Wednesday, September 8, 2010
Boring




Wednesday, September 8, 2010
Safe, Painless
                               Data Migration


Wednesday, September 8, 2010
Delayed Execution




Wednesday, September 8, 2010
Run commands out of
                            process




Wednesday, September 8, 2010
Celery


                 » 19610 lines of docs
                 » 13822 lines of tests
                 » http://celeryproject.org/
                 » Written by Ask Solem




Wednesday, September 8, 2010
Setup


                        » pip install django-celery
                        » Add ‘djcelery’ to Installed Apps
                        » Syncdb
                        » Configure your settings backend
                        » Add @task decorator to function



Wednesday, September 8, 2010
When and Why


                 » Makes your site fast
                 » Use for tasks that users don’t
                   immediately care about
                 » Even if they do, return fast to a
                   waiting page



Wednesday, September 8, 2010
Examples



                 » Activity
                 » Sending Email
                 » Complex DB queries




Wednesday, September 8, 2010
Wednesday, September 8, 2010
Path



                 » Start with ALWAYS_EAGER
                 » Use a ghetto queue
                 » Rabbit MQ




Wednesday, September 8, 2010
Awesome features



                 » Run on multiple machines
                 » Cron replacement
                 » Good error reporting




Wednesday, September 8, 2010
Magically make your code
             async


Wednesday, September 8, 2010
Remote Execution




Wednesday, September 8, 2010
Run commands on remote
            servers (for deployment)




Wednesday, September 8, 2010
Fabric


                 » 7272 lines of docs
                 » 4572 lines of tests
                 » http://fabfile.org
                 » Written by Christian Vest Hansen &
                   Jeff Forcier



Wednesday, September 8, 2010
Setup



                 » pip install fabric
                 » Add commands to a fabfile.py
                 » fab <command>




Wednesday, September 8, 2010
Simple example

            #Fabfile
            from fabric.api import run

            def host_type():
              run('uname -s')

            # Command
            $ fab -H example.com host_type




Wednesday, September 8, 2010
Write python to deploy
                   your code


Wednesday, September 8, 2010
Deployment




Wednesday, September 8, 2010
Gunicorn


                 » 1898 lines of docs
                 » 2172 lines of tests
                 » http://gunicorn.org/
                 » Created by Benoit Chesneau




Wednesday, September 8, 2010
Setup



                        » pip install gunicorn
                        » add gunicorn to your Installed Apps
                        » manage.py run_gunicorn




Wednesday, September 8, 2010
Need to install Nginx in
                    front



Wednesday, September 8, 2010
Nginx setup

            server {
                 listen 80;
                 server_name example.com;
                 access_log /var/log/nginx/example.log;

                          location / {
                                proxy_pass http://127.0.0.1:8080;
                          }
            }




Wednesday, September 8, 2010
Awesome Features



                 » Async backend workers
                 » Simple configuration
                 » Python




Wednesday, September 8, 2010
Stupidly Simple,
                               Production Ready
                                  Deployment


Wednesday, September 8, 2010
Packaging




Wednesday, September 8, 2010
Pip & Virtualenv



                 » Written by Ian Bicking
                 » http://pip-installer.org
                 » http://virtualenv.openplans.org




Wednesday, September 8, 2010
Set up


                 » sudo easy_install pip # :D
                 » sudo pip install virtualenv
                 » virtualenv awesome_env
                 » source awesome_env/bin/activate
                 » pip install Django



Wednesday, September 8, 2010
Awesome Features


                 » Separate environments for each
                   application or deployment
                 » Install code from repos
                 » Doesn’t use eggs
                 » User-owned environment



Wednesday, September 8, 2010
Adds community standards
to something everyone was
    doing their own way

Wednesday, September 8, 2010
No more PYTHONPATH
                  hacking



Wednesday, September 8, 2010
Competing Applications




Wednesday, September 8, 2010
APIs




Wednesday, September 8, 2010
APIs




                 » TastyPie
                 » Piston




Wednesday, September 8, 2010
Tagging




Wednesday, September 8, 2010
Tagging




                 » Django Taggit *
                 » Django Tagging




Wednesday, September 8, 2010
Continuous Integration




Wednesday, September 8, 2010
Continuous Integration




                 » Hudson *
                 » Buildbot




Wednesday, September 8, 2010
Smaller Problems




Wednesday, September 8, 2010
Debugging in Development




Wednesday, September 8, 2010
django-debug-toolbar



                 » http://github.com/robhudson/
                   django-debug-toolbar/
                 » Written by Rob Hudson




Wednesday, September 8, 2010
Wednesday, September 8, 2010
Profiles & Registration




Wednesday, September 8, 2010
django-[profiles|registration]


                 » http://bitbucket.org/ubernostrum/
                   django-profiles/
                 » http://bitbucket.org/ubernostrum/
                   django-registration/
                 » Written by James Bennett



Wednesday, September 8, 2010
Filtering




Wednesday, September 8, 2010
django-filter




                 » http://github.com/alex/django-filter
                 » Written by Alex Gaynor




Wednesday, September 8, 2010
Wednesday, September 8, 2010
Finding packages




Wednesday, September 8, 2010
Djangopackages.com




Wednesday, September 8, 2010
Unsolved Problems




Wednesday, September 8, 2010
Template Tags




Wednesday, September 8, 2010
Logging




Wednesday, September 8, 2010
Model Introspection




Wednesday, September 8, 2010
Class Based Views




Wednesday, September 8, 2010
Source code arrangement




Wednesday, September 8, 2010
Notifications/Email




Wednesday, September 8, 2010
Debugging in Production




Wednesday, September 8, 2010
OpenID/OAuth




Wednesday, September 8, 2010
VCS Abstraction




Wednesday, September 8, 2010
Positive Note




Wednesday, September 8, 2010
Cal’s list of problems ’08
                 » Multiple Databases
                 » Multiple multi-keyed cache requests
                 » Slow HTTP requests while we're doing other stuff
                 » ORM creates dumb SQL
                 » Verbose template syntax
                 » No query debugger
                 » Ugly SQL syntax
                 » Commit all fields at once
                 » No mascot
                 » No deployment system
                 » Migrating Models
Wednesday, September 8, 2010
Cal’s list of problems ’08
                 » Multiple Databases
                 » Multiple multi-keyed cache requests
                 » Slow HTTP requests while we're doing other stuff
                 » ORM creates dumb SQL
                 » Verbose template syntax
                 » No query debugger
                 » Ugly SQL syntax (Table aliases)
                 » Commit all fields at once
                 » No mascot
                 » No deployment system
                 » Extending models
Wednesday, September 8, 2010
Remember


                 » Leverage good applications in the
                   community
                 » Take previous knowledge and apply it
                   to new situations
                 » You can create an awesome
                   application used by other people



Wednesday, September 8, 2010
Questions?




                 » eric@ericholscher.com
                 » twitter.com/ericholscher




Wednesday, September 8, 2010

More Related Content

Viewers also liked

Why Task Queues - ComoRichWeb
Why Task Queues - ComoRichWebWhy Task Queues - ComoRichWeb
Why Task Queues - ComoRichWebBryan Helmig
 
本週遊戲重點新聞
本週遊戲重點新聞本週遊戲重點新聞
本週遊戲重點新聞Natacha Liu
 
2 july 2015 sab ki khabren
2 july 2015 sab ki khabren2 july 2015 sab ki khabren
2 july 2015 sab ki khabrenSantosh Tiwari
 
VU Artificial Turf Proposal Compressed
VU Artificial Turf Proposal CompressedVU Artificial Turf Proposal Compressed
VU Artificial Turf Proposal CompressedGrant Wong
 
Gomez. sped as operationalized by asia's grassroots[1]
Gomez. sped as operationalized by asia's grassroots[1]Gomez. sped as operationalized by asia's grassroots[1]
Gomez. sped as operationalized by asia's grassroots[1]ICTED Philippines
 
スライド確認テスト用
スライド確認テスト用スライド確認テスト用
スライド確認テスト用ktohal
 
Evaluation Question 2
Evaluation Question 2Evaluation Question 2
Evaluation Question 2oliviagodd
 
Begrepsbok
BegrepsbokBegrepsbok
Begrepsbokanetolle
 
BetaCodexC1 - Case Study "Paradigma" on Transformation
BetaCodexC1 - Case Study "Paradigma" on TransformationBetaCodexC1 - Case Study "Paradigma" on Transformation
BetaCodexC1 - Case Study "Paradigma" on TransformationGebhard Borck
 
John Sweeney
John SweeneyJohn Sweeney
John SweeneyInvestnet
 
Stress Testing Masterclass Johnk
Stress Testing Masterclass JohnkStress Testing Masterclass Johnk
Stress Testing Masterclass JohnkTrueventus
 
Komunitas LevitasiHore
Komunitas LevitasiHoreKomunitas LevitasiHore
Komunitas LevitasiHoreLevitasiHore
 

Viewers also liked (18)

Why Task Queues - ComoRichWeb
Why Task Queues - ComoRichWebWhy Task Queues - ComoRichWeb
Why Task Queues - ComoRichWeb
 
本週遊戲重點新聞
本週遊戲重點新聞本週遊戲重點新聞
本週遊戲重點新聞
 
2 july 2015 sab ki khabren
2 july 2015 sab ki khabren2 july 2015 sab ki khabren
2 july 2015 sab ki khabren
 
VU Artificial Turf Proposal Compressed
VU Artificial Turf Proposal CompressedVU Artificial Turf Proposal Compressed
VU Artificial Turf Proposal Compressed
 
6th Wave member Cross-border Living Lab on Territorial Marketing
6th Wave member Cross-border Living Lab on Territorial Marketing6th Wave member Cross-border Living Lab on Territorial Marketing
6th Wave member Cross-border Living Lab on Territorial Marketing
 
Road Fuel
Road FuelRoad Fuel
Road Fuel
 
Gomez. sped as operationalized by asia's grassroots[1]
Gomez. sped as operationalized by asia's grassroots[1]Gomez. sped as operationalized by asia's grassroots[1]
Gomez. sped as operationalized by asia's grassroots[1]
 
スライド確認テスト用
スライド確認テスト用スライド確認テスト用
スライド確認テスト用
 
Evaluation Question 2
Evaluation Question 2Evaluation Question 2
Evaluation Question 2
 
B)Right Idea’S
B)Right Idea’SB)Right Idea’S
B)Right Idea’S
 
Begrepsbok
BegrepsbokBegrepsbok
Begrepsbok
 
BetaCodexC1 - Case Study "Paradigma" on Transformation
BetaCodexC1 - Case Study "Paradigma" on TransformationBetaCodexC1 - Case Study "Paradigma" on Transformation
BetaCodexC1 - Case Study "Paradigma" on Transformation
 
Building Community
Building CommunityBuilding Community
Building Community
 
John Sweeney
John SweeneyJohn Sweeney
John Sweeney
 
Product Photo 2
Product Photo 2Product Photo 2
Product Photo 2
 
миопия
миопиямиопия
миопия
 
Stress Testing Masterclass Johnk
Stress Testing Masterclass JohnkStress Testing Masterclass Johnk
Stress Testing Masterclass Johnk
 
Komunitas LevitasiHore
Komunitas LevitasiHoreKomunitas LevitasiHore
Komunitas LevitasiHore
 

Similar to Large problems, Mostly Solved

Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Bastian Hofmann
 
Migration from FAST ESP to Solr
Migration from FAST ESP to SolrMigration from FAST ESP to Solr
Migration from FAST ESP to SolrTNR Global
 
12 hours to rate a rails application
12 hours to rate a rails application12 hours to rate a rails application
12 hours to rate a rails applicationehuard
 
OSMC 2010 | OpenNMS Kickstart by Ronny Trommer
OSMC 2010 | OpenNMS Kickstart by Ronny TrommerOSMC 2010 | OpenNMS Kickstart by Ronny Trommer
OSMC 2010 | OpenNMS Kickstart by Ronny TrommerNETWAYS
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbikailan
 
Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010Adam Baldwin
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Murat Yener
 
Engineering culture
Engineering cultureEngineering culture
Engineering culturePamela Fox
 
In depth with html5 java2days 2010
In depth with html5 java2days 2010In depth with html5 java2days 2010
In depth with html5 java2days 2010Mystic Coders, LLC
 
Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06Skills Matter
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
OvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programmingOvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programmingTor Björn Minde
 
HTML5 impact on application programming
HTML5 impact on application programmingHTML5 impact on application programming
HTML5 impact on application programmingEricsson Labs
 
Scientific Applications with Python
Scientific Applications with PythonScientific Applications with Python
Scientific Applications with PythonEnthought, Inc.
 

Similar to Large problems, Mostly Solved (20)

XQuery Design Patterns
XQuery Design PatternsXQuery Design Patterns
XQuery Design Patterns
 
Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands
 
Migration from FAST ESP to Solr
Migration from FAST ESP to SolrMigration from FAST ESP to Solr
Migration from FAST ESP to Solr
 
12 hours to rate a rails application
12 hours to rate a rails application12 hours to rate a rails application
12 hours to rate a rails application
 
OSMC 2010 | OpenNMS Kickstart by Ronny Trommer
OSMC 2010 | OpenNMS Kickstart by Ronny TrommerOSMC 2010 | OpenNMS Kickstart by Ronny Trommer
OSMC 2010 | OpenNMS Kickstart by Ronny Trommer
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 
Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010Pony Pwning Djangocon 2010
Pony Pwning Djangocon 2010
 
06 data
06 data06 data
06 data
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
Eclipse Orion: The IDE in the Clouds (JavaOne 2013)
 
Meet Couch DB
Meet Couch DBMeet Couch DB
Meet Couch DB
 
Engineering culture
Engineering cultureEngineering culture
Engineering culture
 
In depth with html5 java2days 2010
In depth with html5 java2days 2010In depth with html5 java2days 2010
In depth with html5 java2days 2010
 
Html5 Apps
Html5 AppsHtml5 Apps
Html5 Apps
 
Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
OvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programmingOvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programming
 
HTML5 impact on application programming
HTML5 impact on application programmingHTML5 impact on application programming
HTML5 impact on application programming
 
noSQL @ QCon SP
noSQL @ QCon SPnoSQL @ QCon SP
noSQL @ QCon SP
 
Scientific Applications with Python
Scientific Applications with PythonScientific Applications with Python
Scientific Applications with Python
 

More from ericholscher

Deploying on the cutting edge
Deploying on the cutting edgeDeploying on the cutting edge
Deploying on the cutting edgeericholscher
 
The story and tech of Read the Docs
The story and tech of Read the DocsThe story and tech of Read the Docs
The story and tech of Read the Docsericholscher
 
Read the Docs: A completely open source Django project
Read the Docs: A completely open source Django projectRead the Docs: A completely open source Django project
Read the Docs: A completely open source Django projectericholscher
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suiteericholscher
 
Token Testing Slides
Token  Testing SlidesToken  Testing Slides
Token Testing Slidesericholscher
 

More from ericholscher (7)

Deploying on the cutting edge
Deploying on the cutting edgeDeploying on the cutting edge
Deploying on the cutting edge
 
The story and tech of Read the Docs
The story and tech of Read the DocsThe story and tech of Read the Docs
The story and tech of Read the Docs
 
Read the Docs: A completely open source Django project
Read the Docs: A completely open source Django projectRead the Docs: A completely open source Django project
Read the Docs: A completely open source Django project
 
Read the Docs
Read the DocsRead the Docs
Read the Docs
 
Making the most of your Test Suite
Making the most of your Test SuiteMaking the most of your Test Suite
Making the most of your Test Suite
 
Token Testing Slides
Token  Testing SlidesToken  Testing Slides
Token Testing Slides
 
Django Testing
Django TestingDjango Testing
Django Testing
 

Large problems, Mostly Solved