bongaus.fi - spotting service powered by django
DESCRIPTION
A talk I held at Djangoconfi '12. Beginner level. This talk mainly shows the whole process and stack used.TRANSCRIPT
![Page 1: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/1.jpg)
bongaus.fiSpotting Service
Powered byDjango
Juho Vepsäläinen
![Page 2: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/2.jpg)
● Jukka Raimovaara (Mentalhouse Oy), ○ Perl-guru, hosting
● Juho Vepsäläinen (Koodilehto co-op), ○ Python, JavaScript○ @bebraw (Twitter)○ nixtu.blogspot.com
Who?
![Page 3: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/3.jpg)
● bongaus.fi - Spotting information in one place
● Target (QR) -> url -> Info● Examine info later● Competitions (who spotted most? ...)● Analytics after event
What?
![Page 4: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/4.jpg)
● Initiated by Jyväskylä Design Week (contract work)
● Extended on need basis (AgileJkl pivot)● On longer term we might want to get
some bucks out of it
Why?
![Page 5: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/5.jpg)
Evolution
![Page 6: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/6.jpg)
![Page 7: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/7.jpg)
![Page 8: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/8.jpg)
![Page 9: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/9.jpg)
![Page 10: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/10.jpg)
![Page 11: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/11.jpg)
![Page 12: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/12.jpg)
![Page 13: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/13.jpg)
http://autiomaa.galleria.fi/kuvat/2012/agilejkl/20120418-IMG_8483.jpg
![Page 14: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/14.jpg)
http://autiomaa.galleria.fi/kuvat/2012/agilejkl/20120418-IMG_8530.jpg
![Page 15: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/15.jpg)
http://autiomaa.galleria.fi/kuvat/2012/agilejkl/20120418-IMG_8522.jpg
![Page 16: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/16.jpg)
● Instanssi demo: working Minimum Viable Product (MVP) with a few users
● Design Week: no notable use, bottleneck in content production
● AgileJkl pivot: success, around half (~100) of the attendees participated
Development Notes
![Page 17: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/17.jpg)
Technology
![Page 18: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/18.jpg)
http://dl-web.dropbox.com/u/10320/django/wallpaper/magic-pony-django-wallpaper.png
![Page 19: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/19.jpg)
● Challenge: team of two, tight schedule● Familiar already. Could've used Node or
something else but Django felt like a safe bet
● Admin UI big bonus on retrospect
Why Django?
![Page 20: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/20.jpg)
http://www.flickr.com/photos/12142259@N00/4084706293/ PixelPlacebo CC BY-NC
![Page 21: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/21.jpg)
● Creating a good and responsive CSS layout is tough
● Bootstrap helps quite a bit!● Provides column layout and lots of other
goodies● http://twitter.github.com/bootstrap/
Why Bootstrap?
![Page 22: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/22.jpg)
gunicorn
Architecture
Django 1.3(markdown, sorl-thumbnail, qrcode, jsonrpclib, django-simplegravatar)
Bootstrap
MySQL + South
auth Luova paja
![Page 23: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/23.jpg)
● pip● virtualenv, virtualenvwrapper● git● Adobe InDesign (generated cards)● Adobe Illustrator (logo)● jQuery (Slimbox 2, Masonry, Rating)
In Addition
![Page 24: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/24.jpg)
● Modeled Events, Targets, Spotting and a couple of more
● Defined some business logic there instead of views (good idea in this case)
● Could go further in this by using Managers and some meta-hackery. See http://dabapps.com/blog/higher-level-query-api-django-orm/
Data Model
![Page 25: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/25.jpg)
Lessons Learned
![Page 26: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/26.jpg)
● Definitely worth using● Worked mostly fine● Had to dump it once and build own
custom migration (SQLite to rescue)● South's development (lack of it) worrying
South
![Page 27: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/27.jpg)
http://www.flickr.com/photos/9049083@N04/2332755401/ aldoaldoz CC BY-NC-SA
![Page 28: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/28.jpg)
1. Decided to do some drastic changes to schema
2. Dumped South3. Wrote migration manually4. Migrate data using SQLite5. dumpdata -> JSON6. loaddata -> MySQL7. Use South again
Migration Migraine
![Page 29: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/29.jpg)
http://www.flickr.com/photos/68907151@N00/45751138/ Kevin Severud BY-SA
![Page 30: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/30.jpg)
● SQLite ok for dev● Made it difficult to spot certain issues,
though due to loose constraints● MySQL in production (be careful with
conf! UTF-8, engine)● Maintained demo fixtures for a while
(good idea)
Database
![Page 31: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/31.jpg)
http://www.flickr.com/photos/92079962@N00/165513002/ Esther17 BY-NC-ND
![Page 32: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/32.jpg)
● Django's native auth in dev● Custom solution (ext. auth.) in production● Ext. auth hooks into Django User, though● Some custom code for authorization (ie.
target ownership)
Authentication + Authorization
![Page 33: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/33.jpg)
● Part of Luova paja that runs on a CMS● Provides registration + login (FB, regular)● Effectively performs redirects and uses
JSON-RPC● Utilizes checksums (secret keys) and user
info exchange
On External Auth
![Page 34: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/34.jpg)
http://www.flickr.com/photos/95572727@N00/338474903/ Stuck in Customs BY-NC-SA
![Page 35: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/35.jpg)
● Unit tests for core logic● Eased development somewhat (harder to
break)● Probably should've tested views and urls
too● Acceptance tests that describe the user's
flow might have been handy too to have (Selenium, zombie?)
Testing
![Page 36: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/36.jpg)
http://www.flickr.com/photos/75654019@N00/100230432/ luxuryluke CC BY-NC-ND
![Page 37: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/37.jpg)
● Somewhat useful without customizations even
● Use vanilla version till you need to optimize (request size, amount etc.)
● Customizable using LESS (colors, etc.)
Bootstrap
![Page 38: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/38.jpg)
http://www.flickr.com/photos/25489182@N04/5022825091/ Philipp Lücke BY-NC
![Page 39: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/39.jpg)
● Developing a MVP was a good idea (Instanssi demo)
● The rest grew around that● Pivots affect velocity (new, possibly
conflicting logic)● Tests are essential due to this (easier to
spot goof ups)
Development Speed
![Page 40: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/40.jpg)
"Perfect is the enemy of good"
![Page 41: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/41.jpg)
Summary
![Page 42: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/42.jpg)
● bongaus.fi provides a way to store spotting information in one place
● Might grow into a business of some sort● MVPs are valuable!● Django+Bootstrap was a good combo
Summary
![Page 43: bongaus.fi - Spotting Service Powered by Django](https://reader034.vdocuments.mx/reader034/viewer/2022042613/54568f16af7959755d8b4d1f/html5/thumbnails/43.jpg)
?? ?