Django Switching Databases on Per-View Level
Django has a "multiple databases" feature that lets you read/write data from more than just the default database. I'm going to show you how to switch databases on a per-view level, rather than per...
A Data Migration for Every Django Project
How to use a South data migration to avoid accidentally sending emails from example.com.ProblemConsider the following snippet from Django's docs [1] for sending a confirmation email:CODE:from ...
Deploying a Django Application to dotCloud
As I mentioned in a recent blog post, in the 11 months since I wrote my first post on dotCloud, I now work there. Besides me working there, there has been a lot of other changes at dotCloud, and I...
pyflakes: The Passive Checker of Python Programs
There are several code analysis tools for Python. The most well known is pylint. Then there’s pychecker and now we’re moving on to pyflakes. The pyflakes project is a part of something known as ...
Python的SIGPIPE信号
Have you ever seen a socket.error: [Errno 32] Broken pipe message when running a Python Web server and wondered what that means?The rule is that when a process tries to write to a socket that ha...
High-Resolution Mandelbrot in Obfuscated Python
Here’s a followup to last month’s post about Penrose Tiling in Obfuscated Python.The Mandelbrot set is a traditional favorite among authors of obfuscated code. You can find obfuscated code in ...
分析Python代码的好工具PyLint
Python code analysis can be a heavy subject, but it can be very helpful in making your programs better. There are several Python code analyzers that you can use to check your code and see if they ...
Python中的__new__()详解
Lately I started looking into Django code and wish to write about internals of Django. I started with Django models and will be writing about it soon. For understanding how Django models work, I...
PyPy 1.9发布
We're pleased to announce the 1.9 release of PyPy. This release brings mostly bugfixes, performance improvements, other small improvements and overall progress on the numpypy effort.It also brin...
Python下载文件实例
Downloading files from the internet is something that almost every programmer will have to do at some point. Python provides several ways to do just that in its standard library. Probably the mo...
Using lxml.objectify to Parse XML With Python
A couple years ago I started a series of articles on XML parsing. I covered lxml’s etree and Python builtin minidom XML parsing library. For whatever reason I didn’t notice lxml’s objectify sub...
How to Convert Decimal Numbers to Words with Python
[i=s] 本帖最后由 jieforest 于 2012-6-8 06:23 编辑 It may have been a better idea to have called this this article “How to Convert Floats to Words”, but since I’m talking about currency, I tho...
用Django模型完成更多的任务
[i=s] 本帖最后由 jieforest 于 2012-6-7 04:50 编辑 So you have a Django app, but sometimes you find the Django models too constraining. We will guide you through using Django models to get more o...
Python: Choice of the one obvious way to do it
I just worked on a new Rosetta Code task on Fibonacci-like sequences where the solution works by giving the initial conditions and being returned something that can thencreate members of the defin...
[入门级]Setting up Python in Windows 7
An all-wise journalist once told me that “everything is easier in Linux,” and after working with it for a few years I’d have to agree — especially when it comes to software setup for data jour...
wxPython - How to use the Clipboard
[size=10.5pt]Everyone who uses computers regularly knows that they can copy and paste text. [size=10.5pt][size=10.5pt]What they might notknow is that when you copy something, it goes into a locat...
My Road to the Python Commit Bit
Like many FOSS fans, I always wanted to be an active part of the movement. My last big project was for the Amiga in the past millennium though. Nowadays I’m happy that after years of small-scal...
Beginner’s Vimrc File
[i=s] 本帖最后由 jieforest 于 2012-5-31 12:45 编辑 I have been in and out of using vim a fewtimes now. As I understand it, this is usually the case whentransitioning to using vim fulltime. One ...
Django NewRelic Quickstart (gunicorn.d + Django 1.3 hack)
[i=s] 本帖最后由 jieforest 于 2012-5-30 09:46 编辑 New Relic is an excellent webapplication performance reporting tool. After a great experience using it onHeroku, I went to enable it for an exi...
Keep Your Hook Script in Source Control: Python
[i=s] 本帖最后由 jieforest 于 2012-5-30 09:40 编辑 Commit your hook script. (say pre-commit.sh) at the rootof your project and include the installation instructions in yourREADME/documentation t...