Site News and Views

Choosing a Python Web Framework I – bottling it

Kyran Dale

Tue, 03 Aug 2010 12:27:47 +0000

A few years ago, when choosing a Python Web-framework with which to build Showmedo, life was a little simpler. The big CMS frameworks like Zope and its relatively user-friendly little bro Plone were reasonably well established and there were a few up and coming lighter frameworks, which promised to take one closer to the Python. Standouts here were Turbogears and Django.

I tried using Plone, even bought the book, but found it very unwieldy. Like so many frameworks it was perfectly happy until one wanted to do something outside its workflow plan. Then things got icky, really icky. There was also far too much ‘magic’ going on, and far too little connection with the underlying Python. After this experience Turbogears was a breath of fresh air. I could build a web-site in Python and leverage all the efficiency and elegance of the language up close and personal. What could be sweeter? I enjoyed the experience so much I didn’t give Django a fair crack of the whip. Although back then it was in beta and had been postponing a 1.0 release for a very long time.

Well, time moves on, and if there has been anything as intense as a framework war, it’s fair to conclude that Django has taken the spoils. Which seems fair. It’s a fantastically managed project, the documentation seems top notch (very important point), and the community is huge, enthusiastic and growing. For a more flexible experience Pylons is threatening to steal some of Turbogears thunder, offering a more modular, ‘best of breed’ alternative to Django. One of the big advantages here is the possibility of using the superb and acknowledged king of Python ORM database libraries, SQLAlchemy.

Anyway, today I come to praise something at the other end of the spectrum and newish to the field, namely An entire web-framework packaged in a single Python module, which seemed crazy when first I heard of it. Bottle bills itself as a micro-framework, fast, simple and lightweight. Having had a chance to play around with it, I can testify to this. It makes a superb development server, among other things. After previous battles with Zope/Plone it’s pretty incredible to get a server up and serving pages in a few lines of Python, with one imported module. Here’s the ‘Hello World’ example:

from bottle import route, run

def index(name='World'):
    return 'Hello %s!' % name

run(host='localhost', port=8080)

So, if you fancy getting away from the complexity of the bigger frameworks and getting back to basics, is a great option and an amazing achievement.

In the meantime, a little selection of Python web-framework videos from the Showmedo vaults:

Eric Florenzano’s humungous series, Django from the Ground Up.

Jiang Xin’s Pylons series.

Kevin Dangor’s Ultimate DVD Turbogears set. Note: Turbogears 2 has seen some impressive changes to the framework, but much of Kevin’s presentations is still applicable.

We don’t yet have a screencast, but there will be one soon. In the meantime, the closest to low-level web-appery we have is John Montgomery’s introduction to Python Web Programming CGI
. Note: this is a club series but the linked introductory video is free and gives an overview.

Related posts:

  1. New series – Agile Python+Pylons to build pySvnManager
  2. Learn Google App Engine with ShowMeDo
  3. Introduction to Python web-programming: CGI

Relaunch, Refresh, Renew

Kyran Dale

Sun, 23 May 2010 00:35:59 +0000

Not sure what it is, but it starts with re. Inspired somewhat by a good friend (thanks Steve!) I galvanised a few galvons and decided to redo Showmedo. Chief among the aims was:

  • Make navigation to the video-tutorials much easier/more intuitive.
  • Make the site less visually er weird/fussy/cluttered
  • Reorganize and refactor the codebase and remove the huge amounts of cruft behind the scenes to…
  • Free time in the future.
  • Make things faster. Page-loads, server-load, the works.
  • Giving the club a home.

I think pretty substantial inroads have been made with regard to these goals. Not perfect by any means, but there is now a reasonably solid base on which to build. I’ll be documenting the changes a bit in the next week or so, but hope the new site is a much nicer prospect.

Please feel free to direct any feedback here.


Related posts:

  1. Site Relaunch – customizing that Twitter Widget
  2. A Wing, a Prayer, and the Ol’ Big G
  3. New flash-player being debuted

Site Relaunch – customizing that Twitter Widget

Kyran Dale

Thu, 13 May 2010 15:47:00 +0000

With limited time to post any content to the Blog or Twitter micro-blog, being able to reuse/advartise that content seems like a win-win. Twitter helpfully provide a widget for just this purpose but, out of the box, it’s not quite right for my purposes. But with a little javascript, jQuery and CSS magic that can all be put right.

First a little screenshot to show what the vanilla widget looks like, after a bit of customization that you can perform on the Twitter site (you’ll find the widgets hanging off the ‘Goodies’ link at the bottom of your facebook page:

The widget shown is ok but:

  • I don’t like the header area, with those two Showmedos and a rather redundant Showmedo logo (this is appearing on the Showmedo site).
  • I’d also like to remove the padding to left and right of the tweets to align the text with the rest of the column content.
  • The font-used is lucida-grand but I would prefer to use Verdana, the default font for my site.
  • The ‘twitter’ badge on the bottom left, which is probably most likely to be clicked, takes users to the twitter home page ‘’ but I would like it to direct to my twitter page ‘’.

With a few a lines of css and jQuery javascript these problems are easily addressed.

First we remove the header by finding its css class, ‘twtr-hd’, and using jQuery to hide it. This is equivalent to setting its css ‘display’ attribute to ‘none’.


To change the padding and font-family just add some css to your style-file:

div#contentRight .twtr-widget{
    font-family:Verdana,Arial,Helvetica,"Trebuchet MS",Trebuchet,sans-serif !important;

.twtr-widget .twtr-tweet-wrap {
    padding:6px 0 !important;

Note the use of the !important flags to override existing settings and escape the css cascade. Now twitter themselves, rather frustratingly, set the widget font-style using an !important tag. This means that in order to override it we need to prioritise our !important using the identity ‘contentRight’ of the right column in which the twitter widget appears.

Lastly, in order to direct users clicking the twitter badge to ShowMeDo’s twitter site we use a little jQuert to change the ‘href’ attribute of the twitter link:

    $('.twtr-doc a').attr('href', '');

And we have the resulting, pretty satisfactory widget:
Showmedo's customized twitter widget

Related posts:

  1. ShowMeDo is on Twitter
  2. Relaunch, Refresh, Renew
  3. New Services Site for Professional Screencasts

Using Python strings and dictionaries to create video embedding templates

Kyran Dale

Sat, 27 Feb 2010 13:31:02 +0000

All Pythonistas will recognize the % operator used to format strings:

print "%s world from %s!"%('hello', 'showmedo')

This is similar to its ‘C’ antecedent but, as you would expect and probably know, Python allows containers other than tuples (in the case containing the ‘hello’ and ’showmedo’ strings) to be used in the string formatting operation.

The use of a dictionary rather than tuple to format the string provides a very handy little templating mechanism, used recently in the addition of video embedding strings to the site.

We start with our text-file template, one long string with no pesky line-breaks:

<object width="%(width)d" height="%(height)d" id="%(id)s" data="" type="application/x-shockwave-flash"><param name="m    ovie" value="" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param  [...]   &quot;%(url)s&quot;,&quot;title&quot;:&quot;%(title)s&quot;,&quot;baseUrl&quot;:&quot;;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:true}],    &quot;plugins&quot;:{&quot;controls&quot;:{&quot;url&quot;:&quot;;,&quot;playlist&quot;:true}}}' /></object><br />

Note the variables scattered through the string starting with %(width)d. We’ll be using these, together with a Python dictionary, to create our video-specific embedding string. The method that does the legwork is shown below. It is a member of the ‘Video’ class and in this context ’self’ refers to the video instance in question:

def get_embed_string(self, width=425, height=344):
    t_dir = os.path.join(os.path.dirname(__file__),'templates/')
    embed_template = open(t_dir + 'embed_video.txt').read()
    embed_str = embed_template%dict(
                                  url=movieDirectory() + "%s"%self.get_flv_file_name()
    return embed_str

We open the ‘embed_video.txt’ file (using a little Python os magic to establish a relative directory path) and read its contents, storing them in the ‘embed_template’ string. We then use the ‘%’ operator to assign values to the special (of the form %(foo)x) variables in the template, using a Python dictionary.

The resulting ‘embed_str’ string defines a flash

which can be used to embed Showmedo videos in blogs, articles and the like:

<object width="425" height="344" id="_672" data="" type="application/x-shockwave-flash"><param name="movie" value="" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value='config={&quot;key&quot;:&quot;#$824e5316466b69d76dc&quot;,&quot;logo&quot;:{&quot;url&quot;:&quot;;,&quot;fullscreenOnly&quot;:false,&quot;top&quot;:20,&quot;right&quot;:20,&quot;opacity&quot;:0.5,&quot;displayTime&quot;:0,&quot;linkUrl&quot;:&quot;;},&quot;clip&quot;:{&quot;baseUrl&quot;:&quot;;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:true},&quot;playlist&quot;:[{&quot;url&quot;:&quot;;,&quot;title&quot;:&quot;Scientific Computing Using SAGE: Introduction&quot;,&quot;baseUrl&quot;:&quot;;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:true}],&quot;plugins&quot;:{&quot;controls&quot;:{&quot;url&quot;:&quot;;,&quot;playlist&quot;:true}}}' /></object>

Related posts:

  1. Testing Flowplayer embedding script
  2. New Scribus Video Published
  3. Congratulations for Dai’s 40th Scribus Video!

Python to the Rescue

Kyran Dale

Thu, 25 Feb 2010 14:59:26 +0000

Showmedo caught some flak from the recent Westhost (our main server-provider) troubles. Catch this pretty interesting thread for the gory details. We were actually pretty lucky as the main site remained standing (not the case for many others) but did manage to lose our cron daemon. As a result some restart scripts which check on the health of, among other things, the Python Turbogears process running the site died. Now this script isn’t needed too often <fingers crossed> but if the site falls down and we’re literally asleep then it avoids more than a minute or sos downtime. The crontab line in question looks like this:

*/1 * * * * source /.bashrc && /usr/local/bin/python2.5 /home/showmedo/showmedo/ > /var/log/cron_log

This line tells cron to run every minute and the python process will check the health of Showmedo’s main process, our memcache and mysql servers and a few other things and restart them if anything has fallen over. Having lost cron, I needed a quick hack to perform these duties and found some very cool advice here at Slashdot. For various reasons the recommended bash-scripts seemed to be dying on me, and lacking the time or will to try debugging on fairly foreign turf, I hacked a little Python substitute to do much the same:

  1 import time
  2 import subprocess
  4 while 1:
  5     subprocess.Popen(['/usr/local/bin/python2.5', '/home/showmedo/showmedo/'])
  6     time.sleep(60)

Not pretty, but at five lines quick and succinct. The line 4 while loop sets things running in perpetuity, line 5 uses Python’s newish (and pretty powerful) subprocess module call the module and line 6 takes a 60 second break before continuing the loop.

The script sat duty while I waited for our cron-daemon to return and I slept sounder in my bed as a result.

Related posts:

  1. A Little Downtime :(
  2. Using non-Python files with py2exe
  3. Optimising Genshi Imports

A Little Downtime :(

Kyran Dale

Mon, 22 Feb 2010 10:34:16 +0000

Having to wear my sysadmin hat a little too often this week. I can honestly state that at least one of the bugs wasn’t my fault. At the moment our cron-jobs (timed unix processes) are failing to engage. So when the site falls down, there’s no handy cron-restart. Should be easy to track down and lots of fun :0

Related posts:

  1. Python to the Rescue
  2. Site outages – sorry for the downtime
  3. Christmas wishes

New flash-player being debuted

Kyran Dale

Fri, 08 Jan 2010 22:24:21 +0000

It’s been much more work than anticipated (a definite screencast or three in there somewhere) but we’ve finally moved to the open-source flowplayer Chief benefits are:

  • much cleaner jquery-like API
  • far greater control over the video-player area. Which means…
  • innovative ways of directing users to new content and…
  • with luck much more interactivity with the video-player

p.s. the commenting on-site is getting a much-needed overhaul. With a bit of cookie-magic we should be able to get some dialogues going and vanquish those nasty anonymous comments (mea culpa).


Related posts:

  1. New ShowMeDos: Interactive Flash
  2. Site Relaunch – customizing that Twitter Widget
  3. Site update

Python Beginners Completed! – File Input/Output

Kyran Dale

Fri, 16 Oct 2009 08:54:56 +0000

Finally we’ve finished the Python Beginners über-series in our Club. In total the Club has 118 videos over 15 series all focused on teaching new Python skills. Now we’re done with Python beginners we’ll be expanding our scope.

In just under 30 minutes in the File I/O Tutorial I cover reading text files, writing textfiles, using binary files (with Python Imaging Library as the example) and persisting data with the pickle module.

Now that we’re finished with the raw episodes and our Learning Paths are usable I’m tying together all the Python videos (free+Club) into paths-of-learning that teach you about topics including:

  • Starting to Program with Python
  • Getting Python Installed
  • Walking through fully-written programs (long step-by-step series)
  • Python development environments and tools
  • Python GUI development
  • Django
  • Web-application development

The learning-paths, and learning how to use them effectively, are very much a work in progress. As ever we welcome any and all constructive feedback.

Once we’re done with the Python learning paths we’ll start to tie together all the other topics in ShowMeDo (heck – we have well over 1000 screencast tutorials now!) to make learning much easier.

Related posts:

  1. Python Beginners – Common Variables and Containers Series Completed
  2. New Club series for Python Beginners – Common Variables and Containers
  3. COM and Python with pyWin32

Python 411 podcast interview – thanks Ron!

Kyran Dale

Thu, 28 May 2009 19:41:16 +0000

Ron Stephens, creator of the rather excellent Python411 podcast series was good enough to interview Kyran and myself a couple of weeks back: An interview with the founders of ShowMeDo: May 25, 2009

We cover the history of how we started ShowMeDo with Python screencasts, Kyran’s innovative Learning Paths (which caught MIT’s eye), the special learn-Python-quickly tutorials in our Club, our authors and the 1,000 educational screencasts we’ve built between us to date.

We also discuss how you can share your own knowledge with 100,000 global viewers and end with a light chat about Python 3.0.

Ron has a long list of podcast interviews, check them out if you want to know about topics like Django, Python Visualisation and the Python Learning Foundation.  He also lists many Python tutorials across the web, they are great short-cuts to find what you need.

Related posts:

  1. Ubuntu UK Podcast interviews ShowMeDo
  2. Python Advocacy Podcast (Python411)
  3. 15 New Learning Paths (mostly for Pythonistas)

Python Beginners – Club Collection Takes Shape

Kyran Dale

Tue, 05 May 2009 01:25:59 +0000

Have finally got round to giving the Club videos a bit of presentational structure following Ian’s last file I/O series in his huge Beginner Programming With Python.

Ian’s final series in Beginners brings the club total to 118 videos, 15 video-series and over 10 hours of Pythonic video demonstration <phew>.

Ian’s beginner-sets were conceived as a whole, from introducing the look and feel of Python to covering, in quite a bit of detail, the general Python programming elements. With Lucas Holland’s introduction to the Python standard libraries we have a nice round number of 50 videos, setting clubbers up nicely for the other club videos and some of the intermediate/advanced Showmedo Python series.

Related posts:

  1. New Club videos for “Batteries Included” series on The Python Standard Library
  2. New Club Series for Python Beginners – Loops and Iteration
  3. New Club series for Python Beginners – Common Variables and Containers

15 New Learning Paths (mostly for Pythonistas)

Kyran Dale

Fri, 10 Apr 2009 18:17:47 +0000

We’ve published 15 new Learning Paths to help you build your knowledge of Python, C and Screencasting.  The Paths mix free and Club content in a guided journey, pulling out exactly the right episodes and series to help you complete your knowledge for a particular subject.

Popular Paths include:

If you like the idea of these guided tutorials, please give us feedback and help us to spread the word by blogging and tweeting (@showmedo).

Related posts:

  1. Python Tutorials via Learning Paths
  2. Python Beginners Completed! – File Input/Output
  3. Huge screencast series ‘Developing emol!’ for new Pythonistas

Showmedo Relaunching

Kyran Dale

Tue, 10 Mar 2009 02:41:03 +0000

Frantic scenes aboard the SS Showmedo as we move to a new server and introduce a much-changed site. According to google analytics about one third of our regular audience are currently lost in cyberspace as various DNS caches around the globe send them off to the old site or some weird fusion of old and new.

Moving server has been as stressful as I imagined, probably the reason for all those ‘moving servers is stressful’ blog entries around the web. We’re currently a little rickety and scared to crank up the engines for fear of shaking the ship apart. But, thanks to some caching magic, we seem to be serving pages and videos.

The new site design is the result of finally having a big chunk of hours to dedicate to Showmedo, rather than cadging them after hours from the day-job. I think things are a deal cleaner and more professional, allowing for my being rather an accidental web-developer. The feedback has been pretty positive, which is always nice.

Our new initiative viz web-education is Learning-paths. I’ll be blogging a little about this as soon as I manage to get the server software installed. For all you linux users out there used to the simple pleasures of ‘apt-get install’ or ‘yum’ or ‘rpm’ or any one of the new-fangled ways of getting software onto your *buntu, opensuse, fedora, etc. box, be very thankful; I have been plunged back a couple of decades or so to library-dependency hell and it is a head-trip indeed.

Related posts:

  1. We’re moving to a new host this weekend
  2. Python Beginners Completed! – File Input/Output
  3. 15 New Learning Paths (mostly for Pythonistas)

Incoming Video Tutorials

gasto Esta serie de vídeos deberían de guiar al usuario a usar Blender desde el inicio. Blender [...]
Dai Introduction to Scribus. Thei s first video will introduce you to Scribus the open source [...]
Rocky Bernstein I introduce extensions I have made to GNU Make which allow better error messages, tracing [...]
mro and Ian Ozsvald and Lucas Holland and Dai and gasto See great applications in action. We're gathering examples of really nice applications - [...]
Dai one of or odd videos an a particular subject
Grant Paton-Simpson How to use SOFA Statistics version 1 to produce reports, tables, and charts, and run stat [...]
jharvey HamCAP amateur radio HF propagation prediction and analysis tutorial.
jharvey A quick view of the basics of KICAD a Printed Circuit Board layout tool.

Most Viewed Video Tutorials

Ian Ozsvald Python is not added to the DOS path by default. If you run 'python' from the command li [...]
steve A introduction to using and getting started with OpenStreetMap. Topics covered include us [...]
Jeff Winkler In this ShowMeDo, Jeff Winkler demonstrates using pyWinAuto (v0.3.4) to control a Windows [...]
Siddhi In this tutorial, I introduce the basics of Django by walking you through the development [...]
Kyran Dale Here we take you through the simple steps required to have wxPython up and running on your [...]
Kyran Dale Python offers powerful and convenient tools for working with databases. Here we summarize [...]
unpingco Matplotlib is one of the best, if not the best, plotting package for scientific Python. I [...]
Ian Ozsvald I'm often asked 'what are the resources and tutorials like for Python?' so here I try to [...]

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Follow Our Tweets
For site-news, video announces, info on building a web-site with Python, jQuery, javascript, CSS, Flash (ugh) and plain interesting FOSS news follow our tweets.
Follow Our Blog
For in-depth code analyses, new videos, news from the open-source frontier, Python, jQuery etc. hackery just follow our blog.


Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.