Tweet I recently wrote a quick little fabric function to create a fabric shell. This works with a stock fabric install, you just might have to change where you import it from. It is at my Github page below.
https://github.com/mzupan/fabric_shell
If you place shell.py in the same directory as fabfile.py you can use it like
from fabric.api import * from fabric.decorators import hosts import shell env.hosts = [ 'host1.domain.com', 'host2.
Tweet This is just another reason I find Django so easy.
For example.. Say you are making a monitoring application. Now you have a bunch of servers and you have certain groups of servers. A server can belong in more then one group also. So that is pretty easy and all with Django.
Now in your template you have a few pages. One page that displays the group information like all the servers in the group and another that displays the server information and will list all the groups that server is in.
Tweet MongoDB is getting a lot of press recently. I stumbled across a pretty interesting project called Django-nonrel. This is an attempt to build non-relational databases right into mongodb. Before you could always use a 3rd party ORM or just use pymongo right in Django but then you were missing out on all the nice apps the community has created. So the goal of this project is to make it so you can keep on using those.
Tweet I just dumped my IPhone for an EVO. I wanted it to tether my laptop. I know i can tether using IPhone if I jailbroke it. Why tether on AT&T’s awful network.
So I wrote a simple script for the EVO (should work on most androup 2.x phones also)
The first thing you want to is enable usb debugging mode on your phone
Settings -> Applications -> Development -> USB Debugging
Tweet One issue hosting providers have is the issue with clients needing to run different version of python. One client might need python 2.4 and others might need 2.5. So in comes uWSGI
So this blog post will go over how to install uWSGI on RedHat 5 and making a uWSGI server for both python 2.4 and 2.5 at the same time for different hosts.
So the first thing you want to do is download the source
Tweet I am in the middle of writing a MongoDB plugin for cacti using pymongo and ran into a little issue.
In the Mongo shell this works
> db.stats() { "collections" : 19, "objects" : 145971, "dataSize" : 64785380, "storageSize" : 129544960, "numExtents" : 75, "indexes" : 69, "indexSize" : 25403392, "ok" : 1 } So in pymongo I tried
info = db.command("stats")
Then I got the following traceback
Tweet There’s a lot of buzz right no for noSQL solutions and one of the big ones is MongoDB. I was lucky enough to be sent to MongoNYC conference a month or so ago and it opened my eyes to why noSQL is the way to go for most web applications. As the web is more and more based on user contributions our databases are getting more writes put into them which doesn’t scale well in MySQL.
Tweet I was trying to auto login a user if I had their user object and was getting this error when I just called something like
login(request, user)
Well this is due to Django wanting to make sure you auth the user first. If you want to bypass this you can just use the following before login
user.backend = 'django.contrib.auth.backends.ModelBackend'
This might not be the best solution but it works
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 of middleware to only print out errors in all ajax requests if the app was in DEBUG mode.
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 doing custom validation in each model form I created.