django + screen

I was working on a website, and quite often I open shells (I use Konsole), often leveraging the tabs Konsole has built in. But I sometimes hate having to switch tabs to see something, compare, reference etc.

My best solution was to keep Konsole windows separate. In Django I would run a konsole window on my top LCD display to display the running application (you know the ./ runserver). While in a konsole window on my laptop display I would run yet another Konsole window to write code, etc.

I often use screen, but similar to tabs with Konsole, I get tired switching screens. Well there are the multiple windows in screen you can set up with a few simple keystrokes, something which I even blogged about previously. Yeah, I know its a cheap shot to link to your own blog! But I assure you, I could care less about how many visitors I get. 🙂

My latest problem with screen has been … on my laptop I reboot often. In fact, I like the idea of being able to shut down, take my laptop with me and pop it back up in a coffee shop, at my skydiving dropzone or even the library. What happens when I reboot? Screen settings are lost, and I have to reset everything back up once I turn the “machine” back on.

Not any longer… I created a screen script:

resize -10
screen 0 ./ runserver
select 0
focus down
screen 1

I named the file django.screen, and created a simple bash script to save keystrokes:

screen -c ~/bin/django.screen

I called this script (django+screen). Anytime I am in a root/django project path, I simply run this command and have my main screen window back where I started.

This gives me a split screen, with all the debug/output information from the development server in the top region, while I code in the bottom portion. The great thing is this is very accessible when/if I decide to remote in via ssh! (Yeah for some strange region I enjoy coding on Linux using VIM!)

I know…not much. There are a few decent examples of screen scripts out there. But not enough in my opinion.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s