@Mike Zupan · Apr 27, 2010 · 1 min read
Tweet Middleware!
I can’t tell you how great middleware is in Django. It makes life so easy! Here is a good example. Django doesn’t handle ajax errors very good. It prints them to the client. Sure I can use firebug but I mainly use chrome now and don’t like to touch firefox anymore. So I wrote a bit …
Read More →
@Mike Zupan · Apr 25, 2010 · 1 min read
Tweet Making custom model fields are a great thing to save a lot of time. If you need a lot of custom validation around your modelforms and don’t want to do a lot of copy and pasting then create a custom model field.
For example, I have the need for a user to input a lot of hostnames and domains and got sick of …
Read More →
@Mike Zupan · Apr 16, 2010 · 3 min read
Tweet Ever had this happen?
[mzupan@laptop SPECS]$ rpmbuild -ba php.spec cat: /usr/include/httpd/.mmn: No such file or directory error: Failed build dependencies: curl-devel >= 7.9 is needed by php-5.2.11-2.fc12.src db4-devel is needed by php-5.2.11-2.fc12.src gmp-devel is needed by php-5.2.11-2.fc12.src …
Read More →
@Mike Zupan · Apr 15, 2010 · 2 min read
Tweet I wrote a bit better init.d script for Jira for Redhat/CentOS
The first thing you want to do is create a sysconfig file. Below is the filename
/etc/sysconfig/jira
The file has the following contents in it
# # The user Jira runs as # JIRA_USER=jira # # The home directory of Jira # JIRA_HOME=/opt/jira/current Now …
Read More →
@Mike Zupan · Apr 9, 2010 · 1 min read
Tweet In the #puppet IRC channel on freenode a user was asking if anyone knew of a init.d script for redhat/fedora for puppet-dashboard. I have a blog post about installing puppet-dashboard on Redhat/CentOS and I don’t think there is any init.d script out there. So time to write one
The first thing you will …
Read More →
@Mike Zupan · Apr 7, 2010 · 1 min read
Tweet To start off with.. I know you can do this in DNS using a search parameter but I don’t want to do that in my envirnoment.
Sometimes you are working with a hostname that is long due to the domain name. This is the case where I am currently working, the domain is theopenskyproject.com. So I did the following …
Read More →
@Mike Zupan · Mar 31, 2010 · 1 min read
Tweet I’ll be the first to call out Google that their gdata python library for connecting into the Google Apps API is the worst.
I wanted to grab all the shared contacts from our domain and it was a giant in the ass. Here is the code I ended up with
import gdata.contacts.client contact_list = …
Read More →
@Mike Zupan · Mar 29, 2010 · 1 min read
Tweet Sometimes you want to be able to create a decorator for functions in Django but have the ability to pass in an argument into the decorator. I came across this when I wanted to switch from the require_login decorator to check if a user was in a certain group to see the function.
So the first thing I did was …
Read More →
@Mike Zupan · Mar 23, 2010 · 1 min read
Tweet This is something that is an easy fix. Nginx is a great web server not only for your primary site but for a proxy as well since it is made to serve a lot of requests very fast.
So it is as simple as this
location / { proxy_pass https://staging; proxy_read_timeout 500; proxy_next_upstream error; break; } The …
Read More →
@Mike Zupan · Mar 23, 2010 · 1 min read
Tweet The decorators that Django has are a great time saver. There are a lot of methods in your views where you only want logged in users to see. So you can use a decorator before the function to check if they are logged in or not.
from django.contrib.auth.decorators import login_required @login_required def …
Read More →