Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Building a Django App Server with Chef: Part 2
Alternate title: Actually doing something useful. Yesterday we covered the basics to getting started with Chef. You should have a remote server configured with chef, and have curl installed! Now lets go ahead and get some useful bits for your Django application. What we'll need So this is going to be based around the way that I set up my servers, so if this is different than you, I'm sorry. However, I think it is a pretty solid way of managing them. A lot of the ideas here are stolen from Travis when he set up the server for Pypants. So lets assemble a list of things we're going to want in order to get a super basic Django configuration running: A user to run our code as and who's home directory we'll store the data. A basic global python ecosystem, including setuptools and pip A virtualenv to store all the project-specific packages and code in A copy of the project that we'll be running Let's get started. The finished code for today is located on github, with the tag blog-post-2. It is a copy of the completed steps, so feel free to peek through that and come back here … -
Handling Django Settings Files
I have seen a lot of talk over the past couple years about how to handle different settings files and databases, synced between production and development. I have happened onto a way of doing it that makes me happy, and figured I would share it with the world. File structure I use a file structure that looks like this: project/ settings/ __init__.py (empty) base.py sqlite.py postgres.py The base.py contains all of the configuration options that are shared among the databases. INSTALLED_APPS, etc. All of the DATABASE settings should be specified in the more-specific files. As well as things that differ by environment, like remote servers, cache settings, cookie domains, and other things. This allows you to run the sqlite settings file, and have it be set to localhost, or whatever your development settings are. Then in production you just run against the postgres settings. A good example of this being used in practice is on Read the Docs. But wait, there's more! manage.py for dev ./manage.py is great for development. It is the easiest way to get started, and it automatically sets up your paths and stuff. With my setup, I actually explicitly set manage.py's settings file to the sqlite … -
Using Haystack to index non-database content
Over on ReadTheDocs, I wanted to build search around the documentation that we're hosting. I chose Haystack and Solr for this, because it's the best way to do search in Django these days. However, I've only ever used Haystack to index content that is in the database. I thought about trying to add all the rendered HTML from the documentation into the database, but that was a non-starter. I ended up adding a ImportedFile model to the database, which would contain the metadata for the HTML file: class ImportedFile(models.Model): project = models.ForeignKey(Project, related_name='imported_files') name = models.CharField(max_length=255) slug = models.SlugField() path = models.CharField(max_length=255) md5 = models.CharField(max_length=255) This allows me to link the SearchIndex in haystack to a model. Then the interesting part is in the Haystack SearchIndex, where I override the prepare_text method, allowing me to read the data in from the filesystem instead of from the database. class ImportedFileIndex(SearchIndex): text = CharField(document=True) author = CharField(model_attr='project__user') project = CharField(model_attr='project__name') title = CharField(model_attr='name') def prepare_text(self, obj): full_path = obj.project.full_html_path to_read = os.path.join(full_path, obj.path.lstrip('/')) try: content = codecs.open(to_read, encoding="utf-8", mode='r').read() return content except IOError: print "%s not found" % full_path site.register(ImportedFile, ImportedFileIndex) This means that I don't have to bloat my database with … -
EuroPython 2008, day 1
After a long year of exiting projects and neverending days at the office, I found myself again from EuroPython conference at Vilnius. The first conference day was full of interesting happenings, mainly reviving old and creating new connections. For all the sessions I attended during the day, I made some notes on few of them. Here are some basic notes about selected ones: Build an App in a Week by Marcin Kaszynski favpico.com etc Suprisingly many of the attendees (about half) use Django Use aDjango admin for users, too (not only for admins) ”Commit early, commit often” Share code only via vcs Use conventions @with_template decorator Note: you can use admin docs (template name) Tests Do save time self.login(), get, find coverage.py Instant Django This talk was interesting but didn’t really give much new stuff (at least for me). There was a discussion about how it makes sense to use convention of naming templates like app/viewname.html but I pointed out that if you for some reason want to part from that convention (that I believe most Django developers use), you can just point Django admin site help section to your designer and just document the fact in your modeldocs. No … -
Django Release Party in Helsinki
Heads up Finnish Djangonauts! Join us for celebrating the Django 1.0 release at Kaapelitehdas, Helsinki tomorrow evening (Saturday 6th) starting at 5 pm. More information on the location and attendees can be found on the event wiki page. This is an open invite — everyone is welcome! See you there! :) -
EuroPython 2008, day 3
For me, the main theme for the third and last day of the conference was Django. Day started with a session by Honza Král about Django newforms admin, which gave me a pretty good idea what I have to do in preparing for the migration to the new admin interface. Later on the day I had many interesting discussions about varions Django-related things, including ideas about having something like Django release party here in Europe, too. Turns out there are quite a lot Djangonauts here in EuroPython, we just arent organized very well so most of us don’t know about each other. Lively after-conference discussions about career choises, Web Design and working with Django in general were definitely the high point of the conference so far. A couple of hour later on the evening, decisions about quiet evening at the Sky Bar (at the 22nd floor of the conference hotel) were forgotten and, again, we headed for the old town. This time we ended up in some night club and, well, yeah, we had a great time :) -
EuroPython 2008, day 2
I skipped most of the sessions for the day as they didn’t seem even remotely interesting to me. But, the ones I did attend where really good. Last nights partying kept me pretty much in bed for better part of the morning. Descriptor tutorial by Raymond D. Hettinger was very good and I think it was actually the first conference tutorial ever that actually teached me something about programming and Python in general. There was quite a bit testing-related material on the Lightning talks. One thing I wrote down on my notes was the phrase ”Given enough tests, all bugs are shallow” (originally from Linus Torvalds in a form ”Given enough eyeballs, all bugs are shallow”). The keynote talk for the day was something that absolutely blew my mind. Hans Rosling talked about Gapminder and how statstical data and databases should be free. First thing that crossed my mind when listening to him was that ”I wonder if Adrian Holovaty has ever talked to this guy — they’d have much to talk about”. If you havent heard about Gapminder or Hans Rosling before, you should definitely see his talk on last years TED conference. In Django-terms, thats some cool shit … -
We Are Django
I’ve always thought that the community is one of the greatest things about Django. Not because Django isn’t great but because the people are just so awesome! Django People is a brilliant new site by Simon Willison and Natalie Downe which brings together Djangonauts all over the world. (Interestingly, I was talking about exactly this same idea yesterday with my friend, in the lines of “there should definitely be something like that”. Great minds think alike (I wish) :) I had the pleasure of meeting Simon and Natalie during the Europython conference last summer. Like every other Django people at the conference, they were super-nice and fun to share thoughts with. The various conversations we had with the Web-gang there were definitely one of the highlights of my last year. I hope that Django People will help in finding more same-minded people, both near you and when traveling around the world. If you are Djangonaut, add yourself to the site! And when you do, please include your picture and some information about yourself. It’s so much nicer to look at real faces than empty rectangles :) Here’s to many more Django friends. -
Django SXSW Lunch Meetup
Hey all you Djabgo devs roaming the halls of SXSW: let's do lunch... -
The basics of creating a tumblelog with Django
On my new homepage, a combined list of my tweets, bookmarks, and user comments on my site appear underneath my latest blog entries. I use a fun bit of Django code to pull these various items together, sorted by publication date, and I'd like to share how this bit of tumblelog-like functionality works. -
Introducing Django JumpToAdmin
Django JumpToAdmin displays links to admin change/delete/list pages when specified objects on a page are hovered over with the mouse. Once clicked, these links open the requested Django admin page in an iframe above the current page. Read on to see a screencast of the UI. -
Introducing CSS Prism, a CSS color inspector
After launching a new site at work in which colors from a previous site weren't replaced in the stylesheet, I decided to find a way to reveal all the colors used in any .css file. When I couldn't find a way, I made one. So today I'm launching CSS Prism, a CSS color spectrum inspector -
Design decisions and highlights of Scripps' newest local news site
Earlier this week, the team at Scripps Interactive Newspaper Group launched a major newspaper website overhaul for the Evansville Courier & Press in Evansville, IN. This project has been brewing for almost a year, and has been a full-time responsibility for some of us for more than six months. Here are some of my favorite changes for readers -
Finding a Django-friendly host just got a little easier
Djangofriendly celebrated its first birthday in March. In its first year, more than 16,000 visitors came by to find and share knowledge on hosting Django applications with various hosts. To celebrate Djangofriendly's birthday, I've gone into a bit of a code sprint, the first phase of which concluded this morning as the new code went live... -
Hosting Subversion on Webfaction
Recent projects at work have finally led me to incorporate Subversion into my Django development workflow. Once I saw the light, I wanted to manage my personal and client projects with the same efficiency, but hesitated to sign up for SVN hosting services on my own dime. Turns out I could add SVN hosting to my existing WebFaction account. Here's how. -
Django development on OS X using a local media server
Host static media from outside of Django while developing locally. For some, this solution will be rather obvious. For anyone else, I hope this helps your workflow like it helped mine. -
Django back on Dreamhost?
An email I received from Dreamhost indicated official support for running Django. After email correspondence with Dreamhost support, it's clear that Django is still not officially supported, but it should run better than it did before they made some recent changes. -
The basics of creating a tumblelog with Django (part 2)
Since posting "The basics of creating a tumblelog with Django," I've received some requests to explain how to get these tumblelog items to actually show up on my homepage. -
Working with the Django admin and legacy databases, pt.2
Working with the Django admin and legacy databases, pt.2 -
Image resizing on file uploads. Doing it the easy way.
Image resizing on file uploads. Doing it the easy way. -
Posting to the Twitter API on an admin change
Posting to the Twitter API on an admin change -
Working with the Django admin and legacy databases, pt.1
Working with the Django admin and legacy databases, pt.1 -
Working with the Django admin and legacy databases, pt.3
Working with the Django admin and legacy databases, pt.3 -
nabuco - Nomadblue Blog - First post
A whole weekend doing some fun coding has produced this brand new kid on the blogosphere. Soon I will write my first "real" post, in the meantime I can't wait to leave the URL to django-nomadblog, the django app that I built to run this weblog: http://bitbucket.org/nabucosound/django-nomadblog You will need Mercurial to clone it out. Hasta pronto! -
nabuco - Nomadblue Blog - django-nomadblog
Updated 13 Sep 2009: The current project page for django-nomadblog can be found here Here it is, the initial documentation for my first django app release, django-nomadblog. Overview This is a basic Django application implementing the most simplest form of a blog (from my point of view, of course). It has been written with an eye on keeping modularity as far as possible, so you won't find lots of goodies in the code, but just a couple of features to help you start hacking. Features A mechanism to tell the application if there's gonna be only one blog or multiple blogs and users, easily configurable via a project setting and a URL pattern. Views are split into two functions, one for the view logic and the other in charge of creating or updating the RequestContext. This enables calling the logic behind a view without rendering the response. It is better explained below. Installation Soon I'll package the whole thing and upload it to PyPi for the sake of standard installations. Mercurial checkout Install Mercurial if you don't have it yet, and clone the repository: hg clone http://bitbucket.org/nabucosound/django-nomadblog/ Symlink to the folder called nomadblog inside django-nomadblog from somewhere in your PYTHONPATH …