DjangoCon Europe 2015: Day 1

I’m lucky enough to be attending DjangoCon Europe this week.  See the schedule of talks for a teaser.  Talks are all being videoed and transcribed and will be shared online soon.

My thoughts and fairly rough notes to self can be found below:

Baptiste Mispelon: Baptiste’s adventures in Djangoland

This speacker was very encouraging of welcoming new members to the community

Look up PyCON INC?? Pixy dust workshops? Must have misheard this but there is another group akin to django girls

Hanna Kollo: Avoiding monoliths

Uses some Erlang – load sensitive

Dealing with fluid requirements

Over engineering upfront to be very modular can lead to issues with referencing other apps

Instead incrementally creating new apps from the initial app.

Grow in a tree like structure, app at a time.

Aim – when you add new feature only need to touch one app

They use a services layer – found idea on stackoverflow article – look up seemed to work for them.

Sounds like their project could be on the scale of BOS codebase.

She thinks services and unit tests first, end user HTML later.

Q: A repo per app

A: Same repo for all the apps

Abdulrahman Alotaibi: Injecting Django into the work environment

Snakes and rubies convinced him to go down the Django vs Ruby path.

Use of clis

See slide that covers principals he brought into place in his team.

Cardiff University Wellbeing service

Daniele puts out a call to assist with sprint to develop something for the Cardiff Wellbeing centre. They are volunteering and offering free 25 minute counselling sessions slots to attendees.

Ola Sitarska: Pushing the pony’s boundaries

Lots of experience creating Django admin interfaces.  Jokes about leaving PHP behind.

Discusses how the admin site is wired together

Useful overrides for admin site:

  • site_title
  • index_title
  • site_header
  • save_as (save as new)
  • show_full_count – may wish to disable in certain circumstances

Ola’s favs:

  • actions_on_top boolean
  • actions_on_bottom

Don’t use list_editable as not currently multi user safe way of editing your database.

ChangeList – if overriding here, maybe you are in too deep

Tips & tricks:

Advanced permissions

method overrides used to achieve permissions for DjangoGirls websites

  • get_queryset
  • get_form
  • get_readonly_fields

Customising changelist

Additional annotations for attributes/properties that appear on changelist.

  • attribute. is_boolean
  • attribute.allow_tags
  • custom actions
  • django admin autocomplete – look up
  • Look up: rowid fields

She wants to see updates to django admin area

Supporting django-flat-theme – updated CSS mainly

Ola wishes admin components were more reusable

Dafydd Evans: CAMEL, the Cardiff Maths e-learning project


Font has held Mathematics back from exploding on the web.

Can we do something with Latex and eLearning

Will unicode come and save us in the end ;)

MathJax is a revolution.  Javascript, accessible browser rendering of Mathematical symbols

Describes a very interesting start of a Maths VLE.

MathML – not human readable

#django live

Django core committers fielded IRC style questions from the audience

Lucie Daeye: Reaching out – Django in the social sciences

Spoke about the importance of bringing humanities students along with digital/programming movement.

Made an interesting point about the lack of non mathematical examples when demonstrating coding constructs.  e.g frequent citations of coding the Fibonacci sequence.

Mentioned a good resource aimed at non programmers, Hello web app.

Yann Malet: Salt for Django developers

Introduced Salt terminology and showed some basic Salt commands.

Presentation tip: Use Ctrl + L to move cursor to be shown at the top of the terminal window

Salt allows you to add breakpoints

salt-cloud – provision AWS etc

mines are data stores

He co-wrote the book High Performance Django

There is talk of hpd-states

Mathieu Agopian: Switching from nose to py.test at Mozilla


a much better write up

pytest-cache --lf run the last test that failed

You can decorate with parameters to re-run the test with different variables

When even Google cannot help you.  Mishearing jungle parler will not help you search for the django parler internationalisation egg ;)  Context helped me decode viable to mean variable a lot sooner ;)

why use py.test?

  • More pythonic – eg use clean asserts
  • well supported
  • Claims current tests are compatible – diff counts beg to differ
  • Look up autouse – node related egg for fixtures
  • Better output

Look out for slide notes – he was very keen on py.test and was using it at Mozilla.

Look into the cricket test tool

Erik Romijn: A sincere tale of Django, developers and security

Walked through an example of a PHP script that he found online that had huge security issues.

He developed an online tool to check security configuration of a django site

All related to prefixed SECURITY_ settings.

Recommends book: Bulletproof SSL and TLS

Remember to test for unexpected cases.  e.g not just test for logged in user, test when not logged in too.

Check out – tracks the releases of your dependencies


Maik Hoepfel: On privilege and moral duty

An almost poetic call to embrace life and do more with our ability to change many lives.



Google input

Even finance companies are considering it

Only a young project


1 app = 1 container

What’s the diff

Uses less space,  only store what is necessary

Start instantaneously

Use cases :
Test prod architecture
Can combine with Jenkins CI CD

Can use base images
And then keep the docker configuration file clean

Is command line tool,  but can use other tools to make simpler

Fig is a helpful tool for creating an infrastructure

Possible mention to and Heroku

Almost no down time,  if upgrading a component

Look at mounting volumes for running local dev code

Can use another app to orchestrate the dockers apps

The Twelve-Factor App by Kristian Glass

Notes taken during a talk at PyConUK

#1 one code repo many deploys

#2 what about declaring your dependencies, e.g. gcc compiled items, deply containers

#3 read config from environment

debug flag, db connections etc
avoids secret leakage,
add defaults
make it language independent

populating env – foreman, supervisor (d?), ansible, bash -whatever etc

doismellburning – django app

www.doismellburning. .com?

NB: can be in another repo, just def outside of your app

#4 Loose coupling

#5 build, release (when config gets blended), run

build tip

fpm – builds an os package (ruby, don’t snigger too much – it’s awesome)

run stage needs to be a simple as possibly, do as much work in advance.  e.g. fetch eggs in build, collect static etc

#6 stateless

assume nothing about RAM, persist data to external serices

#7 Port binding:
clean interface, should be able to tell your app a protocol and port and go

#8 Scale out not up, start more processes, don’t daemonise – let the env do it

#9 Stop quick;y, stop nicely

#10 Keep env similar: time, people, tool gap

Deploy more often

-> get people together, devops, …

-> it works on my machine

#11 Treat logs as event streams

Run a log agreegator

one event, one line

=> q. how do you handle exceptions – let the agreegotr handle this, some differently code new lines.

#12 Run admin tasks in your app, eg clean up old sessions, as a django management command not a one off script on some dev machine

Language and framework agnostics


Notes taken during a Performance talk given at PyConUK.

function calls

c method instead
cython instead

Use operators



list comprehension is quicker than for loop over an emnumerator

What is op?

xrange vs range
– no wasted memory

NB: In python3 renamed range


Or use a c extension



l.sort vs sorted() – any iterator

Key based:

look up operator -> operator.itemgetter

Can use on object attribute


“”.join([a, b, c]) faster but less readable

% method not that fast an ugly – don’t use

Int keys are faster than string keys

interned string keys – no garbage collection

sys.intern – P3

Variable look ups

Mentioned global variable trick

local var faster than global in general

Look up: Old style/new style classes??

Slot attributes ?? look up more just seemed to be attributes???

Don’t use exceptions as an often use case. => much faster say to use getattr than catch a valueexception

Try to rely on c methods

Profiling tools:
c profiler built into Python

cpython vs number – can make pythonrun as fast as C – suggestion