Înapoi la articole →

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 133
  1. Hmmm, this delete statement is taking longer than I thought it would… If you ever have to manually run a SQL delete statement in psql, you can back-up the rows you’re about to delete: \copy ( select * from $table where id in ( ... ) ) to '/tmp/backup.csv'…

  2. Managing South migrations on a multi-developer Django project can be painful.

  3. Bootstrapped virtualenvs

    The excellent virtualenvwrapper supports a postmkvirtualenv script to bootstrap your virtual environments.

  4. At Tangent, we use Zabbix for monitoring and alerting.

  5. Linking to Github

    It was rightly pointed out yesterday that it’s dangerous to link to lines or blocks of code on Github without explicitly specifying the commit hash in the URL.

  6. Continuously rebuild your project

    New developers joining a project will often find that the project won’t build cleanly on their machine, and hours of time will be sunk into setting up the project so work can start.

  7. Using the silver searcher with Vim

    If you’re not doing this already, then you should use the Silver Searcher within Vim for rapid, convenient file searching.

  8. The road to Oscar 1.0

    Oscar 0.7 was released this week, a comparatively minor house-keeping release that allowed us to reduce our pull-request and issue backlogs.

  9. We finally released Oscar 0.6 last week.

  10. Despite its extensive documentation, getting GeoDjango installed and configured can be a pain.

  11. Enhancing your Git commit editor

    Confession: I am a pedant, especially around commit messages.

  12. I wasted at least twenty minutes getting this to work.

  13. TLDR: Parameterised tests are a useful testing technique.

  14. At Tangent we handle environment-specific configuration of Django projects using the method outlined by David Cramer.

  15. Conditional logic in Django forms

    The problem It’s common for UX professionals to design forms like the following: where radio buttons are employed to split the form into sections, each of which can have its own fields which are only mandatory if the parent radio button is checked.

  16. PyPI README badges

    Thanks to @kuramanga, it’s now possible to add shiny PyPi badges to your Python project READMEs that indicate the latest released version on PyPI and the total number of downloads.

  17. Every now and again, an innocent python developer checks out a new git branch then proceeds to bang their head against a bug caused by an orphaned .pyc file from the previous branch.

  18. Consider this curio: import mock from django.utils.functional import curry no_database = curry( mock.patch, 'django.db.backends.util.CursorWrapper', Mock(side_effect=RuntimeError("Using the database is not permitted"))) This snippet creates a decorator th…

  19. Problem You want to install PIL on 64-bit Ubuntu 12.04 (Precise Pangolin).

  20. Using the Hub library, it’s possible to convert Github issues into pull requests.

  21. Problem You’re using Postgres with Django.

  22. Problem You’re using Postgres.app on a Mac for local development but are getting SQL errors from your application.

  23. Mathematics and engineering

    Structure and Interpretation of Computer Programs is full of interesting footnotes.

  24. I work at an agency where we pay $200 a month to Github for their platinum plan.

  25. External parties often need to upload data to your application.

  26. Since watching Carl Meyer’s superb ‘Testing and Django’ talk, I’ve been using Ian Bicking’s WebTest library for functional tests, via django-webtest.

  27. Inspired by Jacob Kaplan-Moss’s excellent talk “Django doesn’t scale” at this year’s OSCon, I’ve put together a Django package for re-populating caches asynchronously.

  28. Use models for uploads

    All Django developers will deal with file uploads at some point.

  29. Problem You want to add i18n support to an existing project.

  30. How to use a South data migration to avoid accidentally sending emails from example.com.

  31. Problem You are serving a Django application using Nginx to proxy to an Apache server running mod_wsgi and you want to allow slashes in your URL keywords.

  32. Working with URLs in Python feels clunky when it should be pleasant.

  33. Embedding HTML in Django messages

    Problem You want to embed HTML within a message using Django’s messages framework.

  34. Problem You want a unix-like tool for manipulating CSV data from the command-line.

  35. How to reload Django's URL config

    Problem For some reason, you need to reload your Django URL config.

  36. Problem You want to validate a post/zip-code when you only know the country at runtime.

  37. Problem You want to all the PyCon videos on your iPhone for offline viewing.

  38. Here’s a few tips for using a Git pre-commit hook.

  39. Confoo 2012 presentations

    I gave two presentations at Confoo 2012 - below are the abstracts and slides.

  40. Testing HTTPS handling in Django

    Problem You want to test how your application handles HTTPS requests.

  41. Django provides several mechanisms for loading initial data for models, such as leveraging JSON fixtures or files of raw SQL - James Bennett offers a good overview.

  42. A Fabric function for git tagging

    Listed below is a Fabric function for determining the appropriate git reference to deploy during a deployment.

  43. A client site went down today.

  44. Problem You’re a python hacker using virtualenv and virtualenvwrapper on a range of projects.

  45. For some reason, I keep finding myself writing unit tests that need to make assertions about an XML document.

  46. Rewriting codeinthehole.com

    I rewrote this blog recently with the following aims: to make it as easy as possible to create a new article, using reStructuredText (RST); to clean up and simplify the design, focussing on the readability of articles that include code snippets.

  47. This is just for my own reference as I always forget the dependencies for setting up MySQL on a new machine.

  48. Problem The python package installer pip can be used to install directly from Github, like so: pip install git+git://github.com/tangentlabs/django-oscar.git#egg=django-oscar This will install from the HEAD of the master branch.

  49. Problem By default in Python (and Django), the documented console handler emits to STDERR, but you want it to use STDOUT instead.

  50. If you use virtual environments on your django servers, then getting manage.py commands to run from cron is a little tricky.