Django community: Django links RSS
This page, updated regularly, aggregates Django links from the Django community.
-
Lista de discução Django Brasil
Lista de discução Django Brasil. -
Django Developers
Django Developers & Jobs -
Django Debug Toolbar Screencast
A screencast showing off the refactored UI in the 0.8 release of Django debug toolbar. -
Django Jobs
Django Jobs is a project focused on providing a database of django developers from around the world, and to act ... -
Ajax post requests CSRF fix
Adding this to a javascript file that is included on your site will ensure that AJAX POST requests that are ... -
Aprendendo Django no Planeta Terra
Tutorial bastante didatico e engraçado sobre Django. Tutorial didactic and very funny about Django. -
Ask The Pony
Ask The Pony is a weekly updated weblog, shares knowledge about to Make lightning fast apps that scale with Django. -
Django Developers
Django Developers & Jobs -
Python Academy for Django Courses
If you are interested in a Python or Django courses. Python Academy is specialized in Python training. They offer Open ... -
Python Anywhere
PythonAnywhere is a Python development and hosting environment that displays in your web browser and runs on our servers. They're ... -
django recaptcha spam protection
Spam protection for django forms works perfectly -
Django Best Practices
django development best practices from lincolnloop -
Django Jobs
Django Jobs is a project focused on providing a database of django developers from around the world, and to act ... -
WZhjyLeApXLiUfJC
HiyMPy iqejndiawxvw, [url=http://qijdeqxzvtfo.com/]qijdeqxzvtfo[/url], [link=http://yvympbzixfne.com/]yvympbzixfne[/link], http://ttzoxurkkwrr.com/ -
Ask The Pony
Ask The Pony is a weekly updated weblog, shares knowledge about to Make lightning fast apps that scale with Django. -
Getbarista
Continuous Delivery for Python Get your Django site online in minutes Updating is as simple as git push Automated tests ... -
AppHosted
AppHosted provides the tools and infrastructure to rapidly deploy and host your Python® WSGI compliant applications. Its Code - Deploy ... -
Lista de discução Django Brasil
Lista de discução Django Brasil. -
Django Brasil
Site da comunidade Django Brasil. Community site Django Brazil. -
Aprendendo Django no Planeta Terra
Tutorial bastante didatico e engraçado sobre Django. Tutorial didactic and very funny about Django. -
pydev python ide django integration
PyDev is a Python IDE for Eclipse, which may be used in Python, Jython and IronPython development. Django integration is ... -
Django数据处理的优化
Django数据层提供各种途径优化数据的访问,一个项目大量优化工作一般是放在后期来做,早期的优化是“万恶之源”,这是前人总结的经验,不无道理。如果事先理解Django的优化技巧,开发过程中稍稍留意,后期会省不少的工作量。一 利用标准数据库优化技术:传统数据库优化技术博大精深,不同的数据库有不同的优化技巧,但重心还不是有规则的。在这里算是题外话,挑两点通用的说说:索引,给关键的字段添加索引,性能能更上一层楼,如表的关联字段,搜索频率高的字段等。Django建立实体的时候,支持给字段添加索引,具体参考Django.db.models.Field.db_index。按照经验,Django建立实体之前应该早想好表的结构,尽量想到后面的扩展性,避免后面的变更使得表的结构面目全非。使用适当字段类型,本来varchar就搞定的字段,就别要text类型,小细节别不关紧要,后头数据量一上去,几亿几亿的数据,之前的小字段就是大问题了。二 了解Django的QuerySets:了解Django的QuerySets对象,对优化简单程序有至关重要的效果。QuerySets是有缓存的,一旦取出来,它就会在内存里呆上一段时间,尽量重用它。举个简单的例子:了解缓存属性:>>> entry = Entry.objects.get(id=1)>>> entry.blog # 博客实体第一次取出,是要访问数据库的>>> entry.blog # 第二次再用,那就是缓存里的实体了,再不用访问数据库但下面的例子就不一样了,>>> entry = Entry.objects.get(id=1)>>> entry.authors.all() # 第一次all函数会查询数据库>>> entry.authors.all() # 第二次all函数还会查询数据库all,count exists是调用函数(需要连接数据库处理结果的),注意在模板template里的代码,模板里不允许括号,但如果使用此类的调用函数,一样是查询数据库的,能用缓存就别连接数据库出处理结果。还要注意的是,自定义的实体属性,如果调用函数的,需要自己加上缓存策略。利用好模板的with标签:模板中多次使用的变量,要用with标签,把它看成变量的缓存行为吧。使用QuerySets的iterator():当获取大量的实体列表而仅使用一次时,一般QuerySets先调用iterator再缓存,这样会耗费大量宝贵的内存,这时iterator()能帮到你,iterator()省去了缓存步骤,显著减低内存占用率,具体参考相关文档。三 数据库的工作就交给数据库本身计算,别用Python处理:比如,使用 filter and exclude 过滤不需要的记录,这两个是最常用语句,相当是SQL的where。同一实体里使用F()表达式过滤其他字段。使用annotate对数据库做聚合运算。不要用python语言对以上类型数据过滤筛选, 白白浪费内存。使用QuerySet.extra():extra虽然扩展性差,但很功能强大,实体里需要需要增加额外属性,不得已时,通过extra来实现,也是个好办法。使用原生的SQL语句:如果发现Django的ORM已经实现不了你的需求,而extra也无济于事的时候,那就用原生SQL语句吧,用Djangoango.db.connection.queries去实现你需要的东西。四 如果需要就一次性取出你所需要的数据:单一动作(如:同一个页面)需要多次连接数据库时,最好一次性取出所有需要的数据,减少连接数据库次数。此类需求推荐使用QuerySet.select_related() 和 prefetch_related()。相反,别取出你不需要的东西,模版templates里往往只需要实体的某几个字段而不是全部,这时QuerySet.values() 和 values_list(),对你有用,它们只取你需要的字段,返回字典dict和列表list类型的东西,在模版里够用即可,这可减少内存损耗,提高性能。同样QuerySet.defer()和only()对提高性能也有很大的帮助,一个实体里可能有不少的字段,有些字段包含很多元数据,比如博客的正文,很多字符组成,Django获取实体时(取出实体过程中会进行一些python类型转换工作),我们可以延迟处理正文工作,只处理关键的字段,这时QuerySet.defer()就派上用场了,在函数里传入需要延时处理的字段即可;而only()和defer()是相反功能的。使用QuerySet.count()代替len(queryset),这两个方法得出的结果是一样的,但前者性能优秀很多。同理判断记录存在时,QuerySet.exists()比if queryset实在强得太多了。当然一样的结果,在缓存里已经存在,就别滥用count(),exists(),all()函数了。五 懂减少数据库的连接数:使用 QuerySet.update() 和 delete(),这两个函数是能批处理多条记录的,适当使用它们事半功倍;别一条条数据去update delete处理。对于关联的记录,一次性取出来了,获取外键的时候,直接取关联表的属性,而不是取关联属性,如:entry.blog.id优于entry.blog_id善于使用批量插入记录,如:Entry.objects.bulk_create([ Entry(headline="Python 3.0 Released"), Entry(headline="Python 3.1 Planned")])优于Entry.objects.create(headline="Python 3.0 Released")Entry.objects.create(headline="Python 3.1 Planned")前者只连接一次数据库,而后者连接两次哦。还有相似的动作需要注意的,如:多对多的关系,my_band.members.add(me, my_friend)优于my_band.members.add(me)my_band.members.add(my_friend)为什么,批量处理的角度自己琢磨一下。 -
Django Virtualenv with Eclipse
Setting up Django virtual environment via python Virtualenv with Eclipse -
hackedexistence - django tutorials
New Django tutorials -
Ajax post requests CSRF fix
Adding this to a javascript file that is included on your site will ensure that AJAX POST requests that are ...