django

Django Projects to Django Apps: Converting the Unit Tests

Recently I went through a process of breaking a large django project into smaller installable applications. Each smaller component could be reused from within any number of django projects, but wasn’t a django project itself. One of the issues I encountered was “What do I do with the unit tests?” Using the standard ./manage.py test no longer worked for me because my settings where in the master project. I had heard of py.

Django view decorators

I recently worked on a project that required a standard account and profile system. django-userena is usually my goto project for this due to its ease of setting up and its extensibility. There’s a subtle nuance to using this project’s default urls patterns in that the majority of the url patterns require passing the user’s username in the url. The username is then used in the view to find the user, since usernames are unique to the user.

Django Deployment on Webfaction

Recently I deployed a django application to WebFaction (this blog!). While this wasn't the first app I've deployed there, I did forget a few steps along the way which required a bit of research and experimentation on my part. To avoid this in the future, I've documented the steps I took to deploy the app here. I'm going to assume that you have a django app working for you locally. If you don't have one, feel free to use this sample project available for download in bitbucket.

django-sitemap-module-object-has-no-attribute-valu

I ran into an issue trying to generate a sitemap.xml file with Django’s built in sitemap view. After reading the documentation over a few times I still received the error: Django sitemap: ‘module’ object has no attribute ‘values’ For some reason, it wasn’t obvious to me what the confusion was, but clearly others have encountered the issue as well. A quick google search turned up a question on StackOverflow.