Skip to content

Instantly share code, notes, and snippets.

@rodrigogadea
rodrigogadea / flower.sh
Created January 3, 2014 01:30
Quick and Dirty bash script to daemonize Flower - i.e. /etc/init.d/flower
#!/bin/bash
NAME=flower
DESC="flower daemon"
# Name of the projects settings module.
export DJANGO_SETTINGS_MODULE="yourproject.settings"
# Path to virtualenv
ENV_PYTHON="/home/youruser/.virtualenvs/yourvirtualenv/bin/python"
@rodrigogadea
rodrigogadea / Message
Last active December 23, 2015 03:48
Problem understanding how DRF works
Hi! (I'm leaving this Gist because it may be easier to read than in the mailing list: https://gist.github.com/rodrigogadea/6575452)
The past days I have been struggling with understanding how DRF works. Coming from tastypie, I don't know if my head keeps thinking in tastypie or I'm not getting the internals or how it should be coded with DRF (probably the 3 of them).
We have these 4 models (in models.py): Bookmark, URL, ImageThumbnail and Topic (we have more, but they are not relevant =P)
class Bookmark(models.Model):
url = models.ForeignKey(URL)
owner = models.ForeignKey(User, related_name="bookmarks")
thumbnail = models.ForeignKey(ImageThumbnail, null=True, blank=True)