Jake Trent

Tag: Python

Serve a Directory

Don’t you hate developing a blasted simple webpage that does some asynchronous requests that gets you into cross-origin policy trouble. If you just read a .html file off the file system, this will bite you. But, it’s easy to get around. Just host your .html file on a simple http server. And it’s easy to make that happen. Here’s one way.

Read more

django_content_type_app_label_key Constraint on Heroku

Django comes with some awesome CLI tools. Manage.py is a beast of magic and lore. And it loves the fantastical kingdom of Heroku, where is romps with merry measure twixt the ether. But, when I’ve tried to go through a dumpdata of a previous site, syncdb on a migration to Heroku, and loaddata for moving the data, I’ve run into a snag on django_content_type_app_label_key more than once. Here are some resolutions.

Read more

Django loaddata on Heroku

Django’s manage.py script comes with some great utilitarian commands. Two of my favorites are dumpdata and loaddata. I’ve used these commands recently to migrate a Django app’s data to the same Django app now running on Heroku. Here’s a little taste of the glory.

Read more

Django on Jython Intro

Here is a “new and shiney” presentation for running Django on Jython. It’s based on my experiences with the DjangoJython tutorial.

As is discussed in the slide deck, and hence the subtitle of the presentation, much could be helped by more careful reading of documentation. Well, moments ago, I decided that I hadn’t checked out django-jython 1.1. Well…. turns out many more problems could have been helped by using this later version. Sweet!

Read more

Django Intro Presentation

At Sort 2009, a technical conference at the LDS Church, I gave a presentation on my favorite all-in-one web framework, Django. It’s a great tool, and here’s a look at the slides produced to accompany my presentation. Also, checkout bitbucket for the source code for the demo project.

Read more

Find django-admin.py

django-admin.py is a utility script that is used by django to start projects, etc. Sometimes, it seems that it’s available to me in the terminal. At other times, it melts away, unavailable. So, where is it, and how do I make it findable?

Read more

Context Processors Put Content On Multiple Pages

In software development, be dry, and define data once. But, what if that data needs to be used in many places? This is the case with parts of a web page, for instance, that are common to many different pages. Django has a great mechanism for this: it is context processors.

Read more

Django Pagination

The amount of content on the blog and its pages has become substantial (in length only) enough to make it a worthwhile idea to paginate it (spread the content over multiple pages). Django makes it very easy! There are some nice objects available for paginating.

Read more

Will a Captcha Block Spam?

I really need an answer to this question. Why? Because I was, until recently, on the verge of shutting down the comments on the site because of the load of blog spam that I was receiving. It was insufferable. But, luckily, Django came to my rescue again and made a potential solution very pain-free – except for one problem.

Read more