Wednesday, September 09, 2009

More DjangoCon Talks

Ian is yakking about, a simple script that changes sys.prefix to a project directory and brings in easy_install. It doesn't include pip yet, but that's coming. He makes it look really easy.

Using easy_install, which goes against PyPI, he's grabbing pip. This is typical for a virtual environment setup, where you want each tool to have the right path.

I switched over to Terminal and started doing this stuff on Jennifer (Patrick's Ubuntu laptop).

I talked to JKT after lunch, found him browsing Steve's binder at the PSF snake display. He indeed plans a short talk based on Chaiman Steve's binder, with both the snake and pony totems a part of the gig.

Frank Wiles, Making your PostgreSQL database sing:

Increasing performance often means doing less, not doing more faster.

postgresql.conf knobs: set shared_buffers to 10-20% of RAM; effective_cache_size to 75% of available RAM; work_mem will give elbow room to ORDER BY.

Materialized views, as distinct from normal views, put a snapshot of data on disk. This works if your local data doesn't need frequent updates. He showed pl/python triggered procedures to do real time updates on the fly.

Panel Discussion: selling your superiors on using Django.

PBS National uses Django extensively, e.g. the Earth Day site, PBS home page, PBS Teachers etc., are all Django sites or use Django components. Producers and stations are also encouraged to use Django (American Experience, Newshour etc.). NASA uses Django for internal file sharing and conference organizing. NASA's SpaceBook is built on Pinax, Marshall uses it, Ames, Nebula uses Django as its core. University of Texas is moving towards Python and Django to upgrade its faculty and student facing portal, replacing some homegrown 1995 solution.

So why Django and not a PHP or Java based solution? PBS was persuaded by OSCON, having dabbled in Zope / Plone. They liked Python a lot. Developers competed around an education pilot, with Django winning the prize (2006). NASA also had Zope / Plone experience, had dabbled in Python, then saw Pimax. Again, showing a working prototype to MVPs won the day. University of Texas also had an evaluation process whereby Python first met the grade, then it was a choice between Pylons, Turbogears, Plone and Django. The learning curve wasn't so steep, a plus when some new developers are coming in with little background or experience.

In sum: rapid prototyping and the ability to move applications between projects is what's winning the day. At NASA, the Django group is consistently performing well, in competition with .NET, PHP and Java developers. Security concerns are important at University of Texas and Django tends to pass security audits fairly easily thanks to some of the plug-ins. Having internal knowledge sharing meetings, as a part of a company's culture, helps cross-fertilize, gets people able to share ideas.

In terms of using open source, it's a good idea to bring your ideas into a company as already open source, versus trying to get company approval to open source something inhouse. As a developer working with Django, it's easier to start your project in the commons, getting around control freaks who think they automatically own the hard work of other people.

The company will likely benefit as open source means leveraging a global talent pool. Other wisdom: if your company offers a congenial environment but seems incapable of choosing the right tools for the job, then maybe that's not the right place for you, i.e. not every company is salvageable, even if it has lots of good people. showing what enterprises use Django should be more front and center. could use this advice as well. Like NASA knew the CIA was using Plone before most people did, which probably impressed some MVPs, soured others. Like PBS wasn't so thrilled seeing its Django site for teachers right next to a Russian bikini-seller's on (I couldn't find that -- yes, I searched).

Training is key. More Django classes. Holdenweb is a player. Productivity, rapid results, is a key turn on. Tuning in the community and the conversations creates a shared buzz. Lore is a glue, keeps the work accessible, to non-techies as well.

Lightning Talks:

Alex Gaynor (@alex_gaynor) on CPython bytecodes. Python VM is stack based. Use dis.dis. Check out these disassembled code fragments!

Chris Heisel is passionate about testing. pywatch runs in real time, running tests as it detects changes on any of the watched files.

Web Cube has some Django ecommerce plugins and best practices to talk about.

Cody Soyland develops Surlex: much more compact than regular expressions. pip install surlex.

Because of technical problems, we need to cut these short (banquet coming in).