Shrinking Images with Python
My wife had a very large image, and she needed some smaller versions of it. Well, I thought I'd just fire up The GIMP and create a few shrunken versions, but by the time The GIMP loaded on my G4 Mac...
View ArticleReview: Beginning Game Development with Python and Pygame
It's been out for a while now, and I'd always meant to write a review for this book... I pre-ordered it, and I've had it for a while, but I haven't worked through the whole thing (though I've hit most...
View ArticleDealing with Unicode and ASCII using Python
Dealing with Character Encodings is (sometimes) hard. It's especially confusing for those who've never done it before. Converting text from unicode to ascii can be tricky. A lot of times, I'll import...
View ArticleChosen.js in the Django admin
Update Nov 23, 2013: I've written a little app ( django-chosenadmin ) that'll automatically add this to every app. Quite some time ago, I ran across the chosen.js plugin for jQuery and Prototype (I'm...
View ArticleLions, Tigers, and Web Development Frameworks, oh my!
Apparently I've stumbled upon a problem that has recently faced many web developers. That is, I would like to adopt an open-source web development framework for mid-sized project. Well... searching...
View ArticleMac OS X, Python, and Fink: Playing Nicely Together
Since upgrading to Leopard, I've been using Mac's default install of python (which is 2.5.1). For the most part it's worked well for me, namely because I've installed additionaly packages either using...
View ArticleThe Structure of a Django App
Previously , I'd lamented the difficultly present in choosing an web development framework. I'd worked through several symfony tutorials, and though I could see the benefits down the road, it just...
View ArticleDjango: Generating an Image with PIL
I've been reading through the Django Book , and in chapter 11 they talk about generating non-HTML content (such as PDF files, Images, RSS/Atom Feeds). They mention using PIL to generate images, but...
View ArticleSelectTimeWidget: A custom Django Widget
I've been meaning to write this blog post for quite some time... Django Models provide a way to create a definitive source of data for web applications. Written as a python class, a Django Model...
View ArticleAdd a Context Processor for your Django app using Sites
I've recently refactored a significant number of my Django Apps so that they include the " sites " framework. Essentially, this allows me to use the same code (and database) for multiple sites. For...
View ArticleDynamically Displaying Fields in a ModelForm
The Problem : I want to dynamically include some fields in a ModelForm based on some external criteria. Sometimes I want the fields displayed, sometimes I don't. I'm going to try to explain this...
View Article树莓派部署Flask框架
Flask又是一种轻量级 Web 应用框架,不过吸引我的原因还是python,与Django和Pyramid也各有千秋,这次将其部署在树莓派上玩玩儿… 上传flask项目文件 这里我只在github上克隆了一个模板,模板比较简单,仅仅只有欢迎页和基本框架。 mkdir -p /home/pi/study/flaskgit clone...
View ArticleDjango Tips #16 Simple Database Access Optimizations
So, I just wanted to share a few straightforward tips about database access optimization. For the most those tips are not something you should go to your code base and start refactoring. Actually for...
View Article"Adding" Q objects in Django
I've got a Django app with the following Model: class Story(models.Model): title = models.CharField(max_length=255) content = models.TextField()The Problem: I wanted to build a simple search feature...
View ArticleMy PYTHONPATH bit me.
I'd just finished the first version of a new django app ( myapp ), and so I pushed it out to my development server. All the new code was in place, so I ran python manage.py syncdb . The result?...
View ArticleGahhh!! Django, virtualenv, and cx_Oracle
UPDATE: Thanks in advance to the comments from Graham Dumpleton whose comments below pointed me in the right direction! This was is a plea for help. I've got django installed and configured with apache...
View Article请不要重复犯我在学习Python和Linux系统上的错误
请不要重复犯我在学习python和linux系统上的错误 昨天来源:51CTO php?url=0EbAkxw82u" alt="请不要重复犯我在学习Python和Linux系统上的错误"...
View Articlepython编码的意义
python编码的意义 23小时前来源:伯乐在线 python2的直钩――编码异常 当你用python打开一篇中文文档,准备读取里面的数据开始实验… 当你处理好你的数据,打算打印出易于阅读的结果给boss检查… 甚至当你刚刚开始编写自己的代码,就写了一句话… 1 text='什么鬼' 只要你开始运行自己的代码,信心满满期待搞定回寝时 UnicodeDecodeError: ‘ascii’ codec...
View Article如何运用Python建立你的第一个Slack聊天机器人?
如何运用python建立你的第一个Slack聊天机器人? 9小时前来源:51CTO php?url=0EbfSqEbqS" alt="如何运用Python建立你的第一个Slack聊天机器人?" />聊天机器人(Bot) 是一种像 Slack 一样的实用的互动聊天服务方式。如果你之前从来没有建立过聊天机器人,那么这篇文章提供了一个简单的入门指南,告诉你如何用 Python 结合 Slack...
View ArticleTalk Python to Me: #79 Beeware Python Tools
Episode #79: Beeware python Tools Published Fri, Oct 7, 2016, recorded Tues, Oct 4, 2016. Could you write me a Python app for the wide range of platforms out there? Oh, wait, I want them to be native...
View Article