Posts tagged: WEB DEVELOPMENT

Neo4J and Graph Databases

Neo4J and Graph Databases

noSQL is a big tent with lots of interesting tech in it. A few years ago at work I got an assignment to evaluate graph databases as a possible datastore for our 40-million-pageviews-a-day CMS. Graph DBs are elegant stuff, though not a particularly special fit for that application. Here’s what I had to say.

Graph databases are all about “highly connected” data. But instead of tracking relationships through foreign-key mappings RDBMS style, they use pointers that directly connect the related records.

A different kind of URL shortener

Today I’m launching my first Google App Engine site. While I built it largely to play with GAE, it is also useful in its own right (I like to think so anyway). It does two different things:

Link shortening without redirection. Put in a godawful long Amazon link and get back a shorter Amazon link. Works with eBay and a few others too. I welcome recipes for other sites. (For the programmers in the audience, which is most of you – yes, the processing is via regular expressions.)

robots.txt via Django, in one line

A significant difference between developing Django sites versus static-HTML-based approaches (among which I count PHP and the like) is that static files, aka “media”, live in a dedicated spot.

Sometimes you need a piece of static content to be available at a specific URL outside your media root. robots.txt for example. This can be done in pure Django (i.e. without even touching your Apache configuration), and is especially nice if your robots.txt content is short. The example below serves a basic “keep out” configuration.

Django LogEntry to the rescue

If you use Django’s admin application, you’re familiar with its “Recent Actions” sidebar. It gives a simple summary of your latest edits, including clickable links to the relevant objects (not any ones you deleted, naturally, but ones you added or changed).

It’s probably not something you look at very often, unless you do such intensive work in the admin that you lose track of things.

Django stores that log data (via the admin’s LogEntry model) for all admin users, a fact which has caused me to repeatedly daydream about writing a custom view or two to display it. In other words, I’d like to let superusers browse all object editing history. Because sometimes you need to answer questions like “When was that changed?” and/or “Who changed it?”

Making your way from PHP to Python and Django

“I’m a PHP programmer and I want to check out this Django thing. What should I do?”

I’ve been seeing this kind of question pop up more and more, and I have a few answers.

First-hand experience as well as many conversations with developers online have led me to the same conclusion: the curious person behind such a question should be encouraged and assisted. (I’ll call that person “Pat” for the rest of the post, for convenience and conscientious gender-neutrality.)