background preloader

Python

Facebook Twitter

Website

Tal. Example. Gendep. Clusto. User:Marshall Hampton/Sage. Welcome to Pyke. Expanding your arsenal with virtualenv and virtualenvwrapper - ...fumbleLog. If you’re a freelancer, then you’re probably working on multiple projects at the same time. If by any chance the projects use different versions of django, then you’re pretty much in version hell, writing bash scripts to change paths and all the other sins. This is where virtualenv will save your rear end. virtualenv is a python module to help you isolate virtual python enviroments. Each environment will have its own python executable, it’s own site-packages effectively allowing you to install completely diferent dependencies for each project.

Installation I prefer pip to all the dirty work for me. Easy_install pip pip install virtualenv pip install virtualenvwrapper This should install both packages to the global python site-packages. There’re some extra steps to setup virtualenvwrapper. . # virtualenvwrapper export WORKON_HOME=~/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh export PIP_VIRTUALENV_BASE=$WORKON_HOME export PIP_RESPECT_VIRTUALENV=true Usage Tips But wait!! Sources. A Crash Course in Django [Server Side Essentials] Are you after a web framework that drastically cuts the time it takes to build data-driven web apps?

A Crash Course in Django [Server Side Essentials]

If so, the Python-based Django might be worth investigating. With a unique architecture enabling extensive code reuse and an automatic admin system, Django is the state of the art for independent web developers, as well as being a strong tool for large scale web projects. In this article, I’ll show you how the basics of setting up your own Django-powered web site. Django is a fully-fledged, high-level web application framework that enables web developers to get robust applications up and running in record time.

It’s powered by Python, which you might be unfamiliar with, but is easy to pick up. Django’s key feature for web developers is the concept of a single web site being powered by multiple, self-contained, function-based applications. Welcome to Django gotchas documentation! — Django gotchas v0.1 documentation. A nobody's take on Python Web Frameworks!! : programming. Python Cheat Sheet. An Introduction to Using CouchDB with Django. Welcome to the final installment of this series, which has looked at the advantages of Django's loose binding philosophy.

An Introduction to Using CouchDB with Django

At first, we looked at replacing Django's templating system with Jinja2. Next, we looked at using SQLAlchemy instead of Django's ORM, and in this third segment we are going to look at using CouchDB instead of a traditional object relational database for data storage. CouchDB is one of the more exciting projects--measured in number of semi-plausible day dreams it has inspired--I've run into in the past year. It is an ideological rival to relational databases, and instead of being focused on highly detailed schemas (long ints, varchars of length 25, and blobs of binary data, oh my) it deals in documents. These documents may be comprised of identical fields, but may also contain dissimilar fields, allowing the same flexibility as Google's BigTable.

Our Project First we need to have Django installed. Getting to Know CouchDB First, we need to start running CouchDB. Python best practices. By leonardo maffi Version 1.30, Jun 16 2011 Sometimes even good programmers at their first tries of Python use less than optimal solutions and language constructs.

Python best practices

In the years Python has accumulated few redundancies and few warts (and some of them will be removed with Python 3.0. Python __Underscore__ Methods. Muller's World - Mike Muller's homepage. ODB (a.k.a.

Muller's World - Mike Muller's homepage

"spugdb" due to a name clash on code.google.com) is a pure-python key-value style database system. It supports nested transactions, object schemas, cursors and a simple, X-Path like query language. ODB is a good fit for situations where you have relatively small storage requirements, low throughput and need a lightweight pure-python database. In simple benchmarking scenarios on modern CPUs and local filesystems, it can handle on the order of 1000 general operations per second, or 300 insertions per seecond.

Tables larger than 100 megabytes have not been tested. ODB started out as a front-end to BDB (Berkeley DB). At this point, ODB is fairly mature. Links. The B-List: Instant web sites. As much fun as it is to write about features of Django which aren’t that well documented, or which aren’t documented (_yet_; one of my goals with each sprint we do is to add to Django’s documentation and bring it closer to being truly comprehensive), there are a ton of features in Django that, while documented, don’t seem to get a lot of use.

The B-List: Instant web sites

Which is a shame, because some of them are extremely powerful and make it almost trivial to accomplish otherwise-complex tasks. So today let’s look at two of these features, and at how they can make your life as a developer ever so much easier. Introspecting a database… Some ORMs work mostly by introspection.