Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
High Performance Django: Shipped
I'm excited to announce that our book, High Performance Django is officially complete. You can buy a copy at highperformancedjango.com now. Thank You Writing the book was hard work and there were definitely times where the challenge felt insurmountable. I couldn't have completed the book without the efforts of a lot of other people: Yann Malet The book's co-author. His real world experience and technical detail were pivotal to the work. Kickstarter Backers Knowing that almost 400 people were counting on having the book was what pushed me through the difficult times. Thank you for putting your faith in the project. Mark Wirblich Mark is behind the design of the book and site. He is new to Lincoln Loop and led the project beautifully. Valerie Coulman Valerie, the book's editor, provided sage advice and the output is far better because of her involvement. Jen Luft Jen managed the delivery of the backer rewards around the world. She is a master of scheduling and coordination. Joni Trythall Joni was in charge of epub and Kindle layouts. She quickly picked up a new set of tools and helped fix some major problems with the small formats. Lincoln Loop Everyone else at Lincoln … -
High Performance Django: Shipped
I'm excited to announce that our book, High Performance Django is officially complete. You can buy a copy at highperformancedjango.com now. Thank You Writing the book was hard work and there were definitely times where the challenge felt insurmountable. I couldn't have completed the book without the efforts of a lot of other people: Yann Malet The book's co-author. His real world experience and technical detail were pivotal to the work. Kickstarter Backers Knowing that almost 400 people were counting on having the book was what pushed me through the difficult times. Thank you for putting your faith in the project. Mark Wirblich Mark is behind the design of the book and site. He is new to Lincoln Loop and led the project beautifully. Valerie Coulman Valerie, the book's editor, provided sage advice and the output is far better because of her involvement. Jen Luft Jen managed the delivery of the backer rewards around the world. She is a master of scheduling and coordination. Joni Trythall Joni was in charge of epub and Kindle layouts. She quickly picked up a new set of tools and helped fix some major problems with the small formats. Lincoln Loop Everyone else at Lincoln … -
My Talk "Factory Boy Fun" at Django London Meetup
On Tuesday I gave another talk at the London Django Meetup Group, titled "Factory Boy Fun", based upon my previous blog post of the same name. The blog post covers pretty much the same stuff, but if you want to flick through the slides quickly for an overview, here they are: -
My Talk "Factory Boy Fun" at Django London Meetup
On Tuesday I gave another talk at the London Django Meetup Group, titled "Factory Boy Fun", based upon my previous blog post of the same name. The blog post covers pretty much the same stuff, but if you want to flick through the slides quickly for an overview, here they are: -
My Talk "Factory Boy Fun" at Django London Meetup
On Tuesday I gave another talk at the London Django Meetup Group, titled “Factory Boy Fun”, based upon my previous blog post of the same name. The blog post covers pretty much the same stuff, but if you want to flick through the slides quickly for an overview, here they are: -
How to add a group choice combo box in a Django user profile form
Assume that you have a Django project where each user belongs to just one group, say Registered or Admin, but not both. You want to show a form in your front-end to let Admin users edit the user profiles, where each user profile is made with First name, Last name, Email and the user group. This task can be accomplished very easily! What you need is a customized ModelForm to add the possibility to edit the user group together with the other fields, and a customized UpdateView to let you set the form initial data for the group field, and to save the changes correctly. Here is the ModelForm: from django import forms from django.contrib.auth.models import User, Group class UserProfileForm(forms.ModelForm): group = forms.ModelChoiceField(queryset=Group.objects.all(), required=True) class Meta: model = User fields = ['first_name', 'last_name', 'email', 'group'] That is a standard ModelForm for the User model, we have just added a group field that is a ModelChoiceField, that is a combo box with all available groups in our project as choices, if you want you can filter the queryset according to your needs. We have also restricted the fields shown in the user profile form to First name, Last name, Email and … -
Understanding get_absolute_url
URL's can be a pain at times, but with get_absolute_url on your model it can make dealing with them on a per-object basis much simpler and cleaner accross your entire site. Not to mention Django itself loves to use get_absolute_url, so it will make other tasks a lot easier.Watch Now... -
DjangoCon 2014: Recap
Caktus had a great time at DjangoCon in Portland this year! We met up with old friends and new. The following staff gave talks (we’ll update this post with videos as soon as they’re available): Mark Lavin, Technical Director, gave two talks: Anatomy of a Django Project and REST: It’s Not Just for Servers. In the photos, you’ll also notice Mark doing some signings of Lightweight Django, his O’Reilly book (already a bestseller on O’Reilly’s list). Karen Tracey, Lead Developer, Technical Manager, Django core committer, and Django Software Foundation member (whew!) answered the question “What is the Django Admin Good For?”. We helped design the website, so it was gratifying seeing the hard work of our design team displayed on the program ad and various points throughout the conference. For fellow attendees, you probably noticed our giant inflatable duck, who came out in support of Duckling, our conference outings app. He told us he had a good time too. Here’s some pictures of our team at DjangoCon: -
Software Design
For some reason I was looking for job titles again today. It's something that I seem to spend time on a few times a year whenever I need to describe, in a few words, what it is that I do. I've never been happy with my assigned titles at work. Developer, Programmer, Architect, Engineer; none of them really embody all that I do, much less what I love doing. I love creating efficient solutions to complex problems. I like to build on the work of others and reuse as much as possible. I'm constantly learning about as much as I can so that I always know what's available. I love organized, elegant code. And I'm never satisfied with a workaround if I haven't figured out the root cause of a problem. Every job I've had, I end up taking on and becoming responsible for so much more than I was hired. I just can't seem to help it. I gravitate to what I love doing—I seem to have a knack for it—even though I never had a title for it. Then I came across the Wikipedia entry for Software Design, and I felt like my search had finally come to … -
Software Design
For some reason I was looking for job titles again today. It's something that I seem to spend time on a few times a year whenever I need to describe, in a few words, what it is that I do. I've never been happy with my assigned titles at work. Developer, Programmer, Architect, Engineer; none of them really embody all that I do, much less what I love doing. I love creating efficient solutions to complex problems. I like to build on the work of others and reuse as much as possible. I'm constantly learning about as much as I can so that I always know what's available. I love organized, elegant code. And I'm never satisfied with a workaround if I haven't figured out the root cause of a problem. Every job I've had, I end up taking on and becoming responsible for so much more than I was hired. I just can't seem to help it. I gravitate to what I love doing—I seem to have a knack for it—even though I never had a title for it. Then I came across the Wikipedia entry for Software Design, and I felt like my search had finally come to … -
Django Projects and Mercurial Subrepositories
A while back, Steve Losh posted some excellent Django advice, in particular the part on working with third-party apps. I thought it sounded interesting but was concerned that it would be a hassle to maintain. Once I finally tried it, it was quite liberating. Never again will I have to work around some issue with a package. Now I just fix it and move on. It did take a bit of work, though, to figure out an approach that I was happy with. I usually use a pip requirements file to keep track of project dependencies and I wasn't quite sure how to make it all work together. One option is to use pip's editable flag like so: # requirements.txt -e hg+https://bitbucket.org/andrewgodwin/south@64fdcc52cd010e663b7a8b9ad592d4aa204807a2#egg=South-dev What I didn't like about that was having to constantly update my requirements.txt to change the revision. And, by default, pip installs editable packages into $VIRTUAL_ENV/src while I'd rather they be in a subdirectory of my project for easy access. My first attempt at dealing with those issues was to fork every single package I was using, add a tag or branch for the revision my project was using and change the requirements.txt file to look like so: … -
Three cheers for SourceTree
I'm not a big fan of GUIs for version control software. On Windows I've tried all the Tortoise incarnations, but they always just seem to slow me down. The built in Git GUI was decent but, at the end of the day, it was always easier to just use the command line. When I switched to using a Mac full time, I didn't spend much time looking. I installed MacHg and GitHub for Mac but never used them. I was, though, having trouble finding a good Mac file comparison tool. On Windows I'd always been relatively happy with Beyond Compare. It was fast and has a ton of features. So, I still haven't found a decent comparison tool for Mac, but I did stumble onto a great VCS GUI. SourceTree has been absolutely great to work with. I pretty much have it open full time as there's no need to switch between apps (it does Git, Mercurial, and SVN). It just happens to have built-in integration for GitHub, BitBucket, and Kiln (of which I use all three). And, as far as I can tell, it's free. If you're on a Mac, I highly recommend it. -
Django 1.7 正式版的新功能介绍
Django开发者及爱好者们期待已久的 1.7 正式版前两天终于发布了,据Django官网的介绍,这一版本相对 […] -
从 Apache 2.2 升级到 2.4 需要更新哪些 Virtual Host 设置?
如果你和我们一样从Ubuntu 12.04升级到Ubuntu14.04, 那么你会发现Apache版本从2.2变成了2.4; 或者你只是将Apache 2.2升级为2.4. 那么你可能会发现Apache无法正常工作了. 你可以使用本篇中所提到的设置时Apache重新工作. 本篇中所提到的Virtual Host设置文件的更新是必须要做的, 否则Apache就无法工作. 本篇博文并不是一个完整的升级指导, 如果需要查看完整的升级指导, 请访问Apache官方升级指导 1. 备份 在升级之前请备份数据文件, 因为升级有可能会使你丢失数据. 2. Virtual Host设置更新 从apache 2.2升级到Apache 2.4: 对于Ubuntu和Debian, 在etc/apache2/sites-available目录中的文件必须以.conf结尾才能被读取 Virtual host设置中的Directory必须有Require all granted才行 <Directory /path/to/public/website/> Require all granted </Directory> 所以, 对于Ubuntu和Debian用户, 你需要修改Virtual host中的2处设置才能使Apache 2.4重新运作, 而其他Linux的用户则只需要做第二项的修改. a. 增加.conf扩展名 (针对Ubuntu和Debian用户) 我们可以使用mv命令为Virtual host文件添加cong扩展名: mv /etc/apache2/sites-available/example.com /etc/apache2/sites-available/example.com.conf 然后使用阿ensite命令重新增加virtual host, 不要忘了添加.conf后缀: a2ensite example.com.conf 对所有virtual host文件重复以上两步, 最后重新载入: sudo service apache2 reload b. 增加权限 (针对所有用户) 打开网站的virtual host文件, 例如/etc/apache2/sites-available/example.com.conf, 在VirtualHost下的Directory中添加Require all granted. 如果存在Require all denied, 则改为Require all granted: <VirtualHost *:80> ... <Directory /path/to/public/website/> Require all granted </Directory> ... </VirtualHost> 保存并对其他virtual host文件执行以上步骤, 最后重新载入: Ubuntu/Debian: sudo service apache2 reload CentOS: /etc/init.d/httpd reload Fedora: systemctl reload httpd.service 此时检查网站是否能正常运行. 3. 其他注意事项 升级过程中默认的virtual host文件可能会从/var/www变为var/www/html, 不要忘了重新静止它. 升级后如果有不兼容的模块的话, 这些模块也会组织apache正常运行, 此时Apache官方升级指导是检查的起点. -
Factory Boy Fun
I've recently been working on improving the test suite at YPlan. The biggest change is moving towards dynamic fixtures for our Django models using “Factory Boy”. This library is essentially a tool that lets you define simple helper functions to generate random, sensible model instances quickly; by using them in tests you can avoid the static JSON fixture files that Django recommends you use in tests by default. Factories are also general purpose - they just generate data and use it to create a model - and so they can be re-used to fill your development database rather than dumping from production. The problem Here's a typical test case: class MyTests(TestCase): fixtures = ['basic.json'] def setUp(self): self.user = User.objects.create( username='adam', first_name='Adam', last_name='Johnson', email='adam@example.com' ) # do some testing ... We have test data in two places with different maintenance strategies - ouch. Firstly, the 'basic.json' file contains JSON objects with data to be passed to the model constructor; and secondly, the call to User.objects.create which contains data in a different format. Also, it's really hard to tell which bits of the data the test depends on, since the fixtures are shared between tests, and to call create on a model … -
Factory Boy Fun
I've recently been working on improving the test suite at YPlan. The biggest change is moving towards dynamic fixtures for our Django models using “Factory Boy”. This library is essentially a tool that lets you define simple helper functions to generate random, sensible model instances quickly; by using them in tests you can avoid the static JSON fixture files that Django recommends you use in tests by default. Factories are also general purpose - they just generate data and use it to create a model - and so they can be re-used to fill your development database rather than dumping from production. The problem Here's a typical test case: class MyTests(TestCase): fixtures = ['basic.json'] def setUp(self): self.user = User.objects.create( username='adam', first_name='Adam', last_name='Johnson', email='adam@example.com' ) # do some testing ... We have test data in two places with different maintenance strategies - ouch. Firstly, the 'basic.json' file contains JSON objects with data to be passed to the model constructor; and secondly, the call to User.objects.create which contains data in a different format. Also, it's really hard to tell which bits of the data the test depends on, since the fixtures are shared between tests, and to call create on a model … -
Factory Boy Fun
I’ve recently been working on improving the test suite at YPlan. The biggest change is moving towards dynamic fixtures for our Django models using “Factory Boy”. This library is essentially a tool that lets you define simple helper functions to generate random, sensible model instances quickly; by using them in tests you can avoid the static JSON fixture files that Django recommends you use in tests by default. Factories are also general purpose - they just generate data and use it to create a model - and so they can be re-used to fill your development database rather than dumping from production. The problem Here’s a typical test case: class MyTests(TestCase): fixtures = ['basic.json'] def setUp(self): self.user = User.objects.create( username='adam', first_name='Adam', last_name='Johnson', email='adam@example.com' ) # do some testing ... We have test data in two places with different maintenance strategies - ouch. Firstly, the ‘basic.json’ file contains JSON objects with data to be passed to the model constructor; and secondly, the call to User.objects.create which contains data in a different format. Also, it’s really hard to tell which bits of the data the test depends on, since the fixtures are shared between tests, and to call create on a model … -
Geo+Django: Geo Beyond the Django slides
Geo+Django: Geo Beyond the Django slides -
New Django Server Setup: Part 1
New Django Server Setup: Part 1 -
Django Internationalization
Django Internationalization -
Upgrades: Django Old to Django New
Upgrades: Django Old to Django New -
Simple Job Queues with django_rq
Simple Job Queues with django_rq -
Imaginary hosts The Onion for a video shoot
Imaginary hosts The Onion for a video shoot -
DjangoCon Performance Optimization Slides
DjangoCon Performance Optimization Slides -
Twelve-Factor Renaissance
Twelve-Factor Renaissance