- Here are all articles tagged Django
-
Django Settings File Tricks
Posted on March 9th, 2013 | Tags: Django
Here are two really awesome tricks that have helped me with keeping my code sane on development and production.
Environment Variables
Environment variables are just like they sound. They are variables local to an environment such as development and production. You can basically store variables on the system so that when Django starts up it can use a certain variable value from development and a different one from the production server. We can set a DEBUG variable like so using a terminal window: …
-
Creating an API With Django
Posted on March 2nd, 2013 | Tags: Python, Django
It's been a crazy week for me put I wanted to make sure I got some useful content out. This week I'll be jumping back to python/django and talking about decorators and how they can be used for creating an API.
A lot of people recommend Tastypie but I like to keep things simple when possible. Most APIs don't need anything as complex as Tastypie and just need something that can restrict access to some functions. Decorators make this really simple to do …
-
RSS Feed Is Live
Posted on February 16th, 2013 | Tags: Django
Over the past few weeks I've been getting requests for an RSS feed. Luckily Django provides a super simple way to convert my blog posts to RSS and Atom feeds.
#urls.py from core.feeds import rss_feed, atom_feed urlpatterns += patterns('', url(r'^rss/$', rss_feed()), url(r'^atom/$', atom_feed()), ) #feeds.py from core.models import Entry from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Atom1Feed from django.utils import text class rss_feed(Feed): title = "Max Burstein's Blog" link = "/blog/" description = "Latest posts from Max Burstein's technical blog" def items(self): return …
-
Realtime Django Using Node.js and Socket.IO
Posted on January 12th, 2013 | Tags: Node.js, Django, Redis
Our goal for today is to build a realtime chatroom using Django, Redis, and Socket.IO. While we'll be building a chatroom the concepts can be applied to almost any web app. At a high level this post will show you how you can convert your REST based app into a realtime web app. I'll be using Django to create the REST based portion but feel free to use any language/framework you're comfortable with. With that said let's jump into the code and get …
-
Threaded Commenting System In Django
Posted on December 29th, 2012 | Tags: Django
The goal of this project is to store a tree (comment thread) in a database. There are several ways to do this and a good list of references can be found at Stack Overflow. The algorithm I'll be using to create our threaded commenting system is called a Materialized Path.
With the Materialized Path algorithm each comment will store the path to itself. For instance, if we post a comment to an empty thread the path to the comment is {1}. Since …
About Me
My name is Max Burstein and I am a graduate of the University of Central Florida and creator of Problem of the Day and Live Dota. I enjoy developing large, scalable web applications and I seek to change the world.