I’ve written a ton of snmp monitoring scripts and they all suck because they are blocking and take “too long” to return results for a large amount of hosts. So how would we make this process faster and make us happier? multiprocessing is a package that supports spawning processes using an API similar to the [...]
Archive for the ‘Fun’ Category
Tweeting from a Django Application
By Andrew Konkol in Fun, Nothing, SysAdminIt’s easy to get your application to start setting twitter status updates in django. Create a twitter account twitter.com Create a twitter “application’ and get your keys dev.twitter.com/apps Click on “settings” and set the access to read and write easy_install python-twitter Use this template Whenever you save a “Post” object, the def send_tweet method will [...]
Indexing Multi-value fields from django-tagging in Haystack
By Andrew Konkol in Fun, SysAdminEnabling tagging on models is easy when you use django-tagging. However, I also have a search feature which is powered by Haystack and Whoosh. I wanted to be able to search for objects by the tags that are associated with them. You need to use the following in your haystack SearchIndex model: tags = indexes.MultiValueField(indexed=True, [...]
django-registration Require a unique email address for registration
By Andrew Konkol in Fun, SysAdminEveryone uses django-registration for… registration… however.. you may get this error: TypeError at /accounts/register/ register() takes at least 2 non-keyword arguments (1 given) Here’s what your urls.py should look like for the /accounts/register/ url: urls.py from django.conf.urls.defaults import * from registration.forms import RegistrationFormUniqueEmail urlpatterns = patterns(”, (r’^accounts/register/’, ‘registration.views.register’, {‘form_class’:RegistrationFormUniqueEmail,’backend’:'registration.backends.default.DefaultBackend’ }), )
Unique Slugs for Django Objects
By Andrew Konkol in Fun, SysAdminI’m working on a new project and decided to use slugs to access object information. The built-in in “slugify” does not generate unique slugs for objects, but I found a solution. Overriding the save method allows us to check to see if there are any other objects which have the same slug such as “how-to-make-a-table” [...]