It's always been a goal of mine to post screencasts here on my blog, but for whatever reason I never ended up getting around to it. Today, that all changes as I have created two new screencasts. Of course, this space is already very well-covered by both Michael Trier and Brian Rosner, so hopefully this adds something new to the conversation.
Setting up a Django Development Environment
In this screencast I show how I typically set up my Django development environment. It goes through installing Django by checking out the latest development version and linking it to the correct places on your system. It also talks about how to install reusable applications. Finally, it covers how to update all of those projects and keep a toolbox of snippets for your personal use.
The simple pylink command that I use in the screencast is this:
#!/bin/bash
ln -s `pwd`/$1 `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/$1
UPDATE: Joshua Uziel has sent me a much more robust version of this script, which handles the edge cases much better. I highly recommend using this version instead of my one-liner.
#!/bin/bash
SITE_PACKAGES="$HOME/prog/python/site-packages"
if [ ! $SITE_PACKAGES ]
then
SITE_PACKAGES=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`
fi
BASE=`basename $1`
DIR=`dirname $1`
cd $DIR
ln -sfnv `pwd`/$BASE $SITE_PACKAGES/$BASE
UPDATE2: Zachary Voase has updated this new version, and it seems to be even more improved. I'm loving this! He has also written a "pyunlink" script, which can be found here.
Please let me know in the comments if you have any other tips and tricks for setting up a development environment for Django.
Using Django-Pagination
Django-pagination is an application that I wrote and released a while ago, which I use all the time, but that hasn't really seen much attention. In this screencast, I show how to take an existing project with too much data on one page, and use django-pagination to quickly and easily paginate the items on the page. There is a bit more documentation for the project that's available in the project directory if you do a subversion checkout, and docstrings throughout the source code, if you're interested in how it works.
Keep in Mind
These are my very first screencasts, ever. I'm not entirely sure what I'm doing yet, and the only way I can improve is by your feedback. If you have any advice and/or criticisms of these screencasts, please don't keep your mouth shut--speak up, and let me know in the comments. Hopefully someone finds these useful, and thanks for watching!
All Content


Wow, excellent work! These are great. You have a real engaging and pleasant sounding vocal delivery. Keep them up.
The pagination one was great, gonna go back and check out the first one just because the second one was so good.
Wow, thanks for the kind words Empty and huxley!
You deserve the praise, those are darned fine screencasts.
BTW, for those who don't know, Empty is Michael Trier of "This Week in Django" podcast fame (and responsible for some great Django screencasts), so praise from him is a sure sign you're doing great stuff.
Awesome. Really great sound and overall quality as empty already stated.
Outstanding!!
This reminds me of how I used to setup my laptop to do Foxpro development (long before webcasts).
This gives me a great starting point, and confirms some of the ideas I've already implemented for django development.
Keep up the excellent work Eric!
John
Great work. I hope you add more screencasts on other django topics.
That's the plan :) Thanks!
The second screencast is great! I'll try django-pagination tomorrow and I hope it is as easy as in your screencast.
Maybe this is the wrong place for asking this, but is it possible to change the URLs from /foo/?page=42 to /foo/page/42/?
Thanks! Right now it's not possible to change away from the GET parameters, but I'd love to support an arbitrary URL scheme. Please open a ticket and let's see if we can figure it out.
BTW, the ticket tracker is here: http://code.google.com/p/django-pagination/issues/list
Very nicely done, Eric. Looking forward to more in the future!
One question I do have is the use of your toolbox module and keeping it in sync with your production server. It seems you must replicate the toolbox module there as well? For this reason, I tend to put things like that in the actual project folder.
I actually have a private repository that I use to sync my toolbox. But really it works well both ways. I tend to keep it globally accessible because it forces me to abstract my patterns for reuse rather than do one-off fixes for each project.
Anything in your toolbox we should include with Pinax?
Not really. Most of it is fairly specific to my projects. Otherwise, it's stuff from djangosnippets that we have replacements for or use already in Pinax.
superb, show more
eric, you did a great job. i know these things aren't easy and take a lot of time. you did great. keep up the excellent work!
Eric,
That was a great screencast - clean, easy to hear, and it's certainly shown the django-pagination application in a very good light!
You're in my RSS feeds now and I'll be looking forward to the next one!
Cheers,
Tone
Very nicely done. You have an engaging and relaxing voice and your topic was well-defined. I thought it was professional indeed.
The pagination screencast is excellent, good length and good pace. I'll be giving pagination a look today because you made it look so easy ! Keep up the great work.
Great Screencasts!
Keep up the good work :)
I must add that the pagination screencast was timely as i was looking at doing exactly this.
thanks
P.S: any chance at requesting screenshots? i would like to see on on django-comments-utils
It might be a good idea to check out http://stephendeken.net/wiki/software/keycastr/ to show what key strokes you take when it is a bit more implicit.
By the way excellent job!
Thanks, that's an awesome tip! I'll probably use it for the next one.
It's amazing, thx for all dude..
Very simple to use.. perfect .. just a number and vouala!
thx !
Eric,
You said at the end of the video that pagination isn't fetching everything as it's lazy-loading. If you're not fetching the entire list, are you querying a second time to get the total count of rows, so you know how many pages are required in the paging?
Al.
Yes, it's not just one round-trip to the database. Behind the scenes, it uses Django's "Paginator" object, so if you want to delve into the exact performance tradeoffs, check that out.
I second that your voice is really good. The problem with a toolbox is the portability of your apps because it depends on your environment, if you want to release an app with an XFNField, you need to remember to copy it before.
I didn't know the pylink script, thanks! I often use manage.py to add the cwd to sys.path, it works fine too, at least for tests.
A small tip for the first screencast, you can use "cd" and it will go to your home folder even if you do not mention the "~".
Keep up :)
Thanks for the compliment!
About the toolbox: You're absolutely right. Like anything else, it's definitely a tradeoff.
Also, it's good to know about plain "cd". I didn't know that was possible!
Very handy. Great presentation.
Good one!
Great screencasts! Did you decide on what specific topic the next one is going to be?
Thanks for your work, I wonder why not use a zc.buildout to create a development environment?
That was so cool.
Now i have new vision about how to setup the development enviroment. Before this video i was always doing the svn up && sudo python setup.py install but that pylink stuff is really cool. Thx. so much. now i m a subcriber of you :)
and maybe for newbies at linux you can explain howto add the ~/bin directory to the users path. liike adding
the export PATH=$PATH:~/bin
row to the
~/.bashrc
file. thx. again. And on linux. it doesn't allow you to make a symlink to the python path. using the command with sudo works fine.
Thx. again
Regards...
Good point, I really forgot that ~/bin was nonstandard! I should have pointed that out :(
Great screencast! Waiting for more!
Is it possible to make a podcast stream in iTunes?
Yep! The URLs to know are these:
iTunes: itpc://djangoscreencasts.blip.tv/rss/itunes/
RSS: http://djangoscreencasts.blip.tv/rss
Miro: http://subscribe.getmiro.com/?url1=http://djangoscreencasts.blip.tv/rss
I am new to the Mac/Mac's terminal and was wondering how you got your pylink script to save in the GNU nano section then go back to the regular terminal?
Awesome screencasts !
Another nice addon to your development environment would be using bash CDPATH.
Create a nice shortcut to each of your apps by:
# export CDPATH='~ericflo/development/pyhton'
These are great. Any plans on making one for setting up a development environment?
Great screencasts! They remind me a lot of railscasts, which is a good thing. I've subscribed to your podcast. Please keep them coming! They are a joy to watch.
Awesome!
Very cool!
Just wondering: I noticed you put your templates and apps under the 'twitterclone' project. Is that how you normally do things? How do you decide when an app belongs within a project or in the development directory? Where do you place your projects? Within the development directory or separately?
Thanks, looking forward to seeing and hearing more :)
-Björn
Just watched the first screencast and was by FAR the best Django screencast I've seen so far. Explained everything clearly, didn't move on or clear the screen too quickly.
As someone who's never programmed before and learning from the ground up this was an invaluable first step. Look forward to seeing more from you in the future :)