Skip to content

Instantly share code, notes, and snippets.

@sesh
sesh / faq.md
Created July 21, 2016 10:44 — forked from shangxiao/faq.md
django faq

Frequently asked questions:

  • Why shouldn't i use mysql? / mongo?
  • Should I use jinja, I read it's faster?
  • Should I use sqlalchemy, I read it's superior?
  • How do i make this thing happen in parallel/not wait for xxx to finish?
  • Why does django ask for a default? (But my table has no data in it wtf django!?!)
    • FunkyBob | I think, perhaps, it's time I wrote a blog post on "why does a migration adding a field need a default?"
  • Why do I need to commit my migrations? Why can't I just run makemigrations on the server?
  • migrations are source, makemigrations is a helper which takes you part way
  • i've seen people accidentally lose their migrations on production…  oops now what?
@sesh
sesh / tests.py
Last active August 29, 2015 14:27 — forked from mekhami/tests.py
class ProjectViewsTest(TestCase):
def setUp(self):
self.project = Project.objects.create(name='google')
self.client = Client()
def test_project_display_context_data(self):
response = self.client.get('/project/{}/'.format(self.project.slug))
self.assertIn('form', response.context)
# Obviously for an actual release, replace <release tag> with actual release tag, eg. r41
# On deploying machine, get fabfile up to date
git fetch origin
git checkout master
git merge origin/master
# ASIA
tsocks fab set_agents:celeryasia,asia deploy_celery mark_deployed:<release tag>
tsocks fab set_agents:appasia,asia deploy_apps mark_deployed:<release tag>
sudo apt-get install unzip;
wget -O /tmp/chromedriver.zip http://chromedriver.googlecode.com/files/chromedriver_linux64_19.0.1068.0.zip && sudo unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/;

MySQL: dumped

Maybe you've read some of the [PHP hate] (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) that's out there. I used to write PHP and you know, it works, you can get things done. The same goes for MySQL. I kind of feel like in this day and age MySQL is the relational database analogue of the [lingering legacy of the PHP singularity] (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html).

Basically, MySQL works and you can definitely use it to build and run successful applications. Facebook uses it. But the important point to consider is that Postgres ..... is better. It's more or less a fact. How and why? Well there are numerous articles out there for you to google up but [here's a screencast] (http://www.youtube.com/watch?v=1PoFIohBSM4) that gives you a reasonable breakdown, by example.

So just like I left PHP behind, now I've left MySQL behind. You could say I've mysqldumped it forever. Now, [WHO'S COMIN WITH ME?!] (http://www.youtube.com/wat