Archive for the ‘Web Programming’ Category

Django App Quick Start

Thursday, September 8th, 2005

I wanted to start writing a Django app which was to allow a user to enter data in various tables, and then run a workflow process.

I liked the admin front-end but thought I needed to do something clever with generic views to replicate this in my own application.

So I asked this question on the django-users list

On 04/09/05, Rachel Willmer  wrote:
> I want to use the generic view mechanism to add/change/delete but I
> don't want to have to write my own form template for each page.
>
> I'd like it to work just like the admin interface does. Is it
> possible/sensible to hook into the admin code which seems to use
> add_stage/change_stage to automatically generate the templates? Or is
> there a better way of doing this?
>
> Any pointers welcome...
> Rachel

Now I’ve read a bit more about it, the answer is of course to just use the admin interface. :-)

django-admin.py includes a useful command “adminindex”, which will auto-generate a copy of the admin interface index page.

So generate that, and copy it into your template directory to over-ride the inbuilt one, as described in Tutorial2

Then you can modify that as you wish…

Hey presto, instant application front end that you can use as the basis for the new application…

In retrospect, this is obvious and documented in the Django tutorial. But at the time, I was thinking in terms of “admin” interface and “main” interface, and it slipped past me that I could in fact use the admin interface *as* the main interface…

That might not work too well for most web applications, but for my purposes, (a local single-user application), it will work just fine…

Rachel

Django search engine

Monday, September 5th, 2005

To help me get to grips with Django quickly, I created a search engine
of the documentation.

On the off-chance this is useful to others, I made it available at http://www.hobthross.com/docs/django/phpdig/search.php

(Sorry if this does not show up as a hyperlink, WordPress appears to be chewing that up and ignoring it)

Django for Python websites

Monday, September 5th, 2005

I’ve just taken a look at Django for the first time, and am seriously impressed.

For a while now, I’ve been trying to find a way of using Python in websites, and haven’t found anything that works well enough – Zope, Cheetah, mod_python – all seem very difficult to get the simplest thing working…

But Django looks like the answer.

The guys behind Django have produced a very useful tutorial to help you get going with it, and the users mailing list seems very responsive…

Very impressed so far…

Writing Apache modules

Monday, August 1st, 2005

Apache1 modules

If you need to know about Apache1 modules, the answer’s simple. Buy the O’Reilly book "Writing Apache Modules with Perl and C”" by Lincoln Stein & Doug MacEachern…

Apache 2 modules

Unless you’ve got the patience of a saint, or already know how to do it, give up now!

:-)

More seriously, the online documentation available to tell you what the (major) differences between Apache1 and Apache2 modules is extremely limited or non-existent. If anyone finds any good links, please let me know!

The Apache2 website has a comment in its notes about the differences between Apache1 and Apache2 to say that the way modules work has been completely rewritten, but doesn’t actually tell you what has been rewritten or what the new method is. The document which should say how to do it is the old 1.3 version with a comment to say that it needs to be updated for version 2.

Very helpful (not!)

If you can afford to buy a book for just two chapters, then buy (another O’Reilly book) "Apache, the Definitive Guide" by Ben Laurie and Peter Laurie. (Make sure you get the 2003 3rd edition)

and look at Chapter 20 “The Apache API” and Chapter 21 “Writing Apache Modules”.

That explains what’s going on in the code. But it doesn’t give you a lot of detail about how to integrate your new module into Apache, so don’t expect it to give you all the answers…

Installing apxs2 on Ubuntu Warty

Saturday, January 22nd, 2005

I need to install an apache module from source, but apxs2 is nowhere to be seen on the system.

apt-cache search apxs2 doesn’t help, where can it be?

A quick question on irc.freenode.net #ubuntu, and the answer is there: install apache2-prefork-dev.