Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Forget print(), Use pdb Instead
How often do you use print statements to display output in your manage.py runserver process to help debug something? This was my go-to method of debugging for a long time. Then I was introduced to pdb. This is so much better and useful, especially when you have situations where you have to do a lot of things in your web application in order to reproduce the conditions you are trying to debug. Using pdb and the interactive debugger is as simple as putting: import pdb; pdb.set_trace() on the line that you want to start the debug session on. When you do this and you hit that line in the execution of your application, you'll see a prompt that looks like this in your manage.py runserver output: > /Users/paltman/dev/mywebsite/mywebsite/profiles/views.py(29)profiles_list() -> if request.user.is_superuser: (Pdb) From here you can issue single letter commands like n, c, or s, which stand or Next, Step Into, or Continue. Next (n) will simply take you to the next line of execution within the current context. Step Into (s) will jump a level deeper (if it makes sense), for example it will step into a function call being made instead of just executing it and returning the … -
django CMS 2.3.2 RC1 released
-
Thoughts after attending Djangocon
The Caktus team attending and having a great time at Djangocon! It's been one week since I posted my wrap-up of the first day at Djangocon, and although I didn't get the chance to cover each day individually I wanted to post a quick conference wrap up. Overall, the talks that I attended were consistently informative and engaging. The consensus of the Caktus team was that everyone attended talks that they walked away from with valuable knowledge or a new approach to developing. The after party events were well attended and due to the centralized location of the conference, it was very easy to try out a few different restaurants and socialize with our fellow conference goers. Djangocon continues to be one of the most enjoyable conferences that Caktus attends and we are already excited about next year! -
Thoughts after attending Djangocon
Click the image to view the entire gallery of the Caktus Team having a blast! It's been one week since I posted my wrap-up of the first day at Djangocon, and although I didn't get the chance to cover each day individually I wanted to post a quick conference wrap up. Overall, the talks that I attended were consistently informative and engaging. The consensus of the Caktus team was that everyone attended talks that they walked away from with valuable knowledge or a new approach to developing. The after party events were well attended and due to the centralized location of the conference, it was very easy to try out a few different restaurants and socialize with our fellow conference goers. Djangocon continues to be one of the most enjoyable conferences that Caktus attends and we are already excited about next year! -
DjangoCon 2012 Recap
DjangoCon 2012 Recap -
Suporte experimental ao Python 3
Suporte experimental ao Python 3 -
Suporte experimental ao Python 3
Suporte experimental ao Python 3 -
Migrating django.contrib.comments to Disqus
As of today I am using Disqus for comments on this site. This meant that I had to migrate the old comments (which used django.contrib.comments) to Disqus. Here’s a short description of how I did this. Obviously I’m not the first one doing this. As a matter of fact, the article Bye-bye django.comments, hello Disqus by Daniel Roseman provided a very good tip: use django-disqus. I just did not use the disqus-export command. Here’s what I did: I installed the app as described in the instructions. I added the required template tags to my templates and removed the old code to show the comments and the comment form. To migrate the old comments I created an additional feed to export the comments as WXR. In Disqus I imported the XML from the feed as a generic WXR. It was a smooth ride (it just took a little over 24 hours for the import to actually finish) and one less thing to do when I move to a static blog based on Acrylamid. -
Einladung zur Django-UserGroup Hamburg am 12. September
Das nächste Treffen der Django-UserGroup Hamburg findet am Mittwoch, den 12.09.2012 um 19:30 statt. Dieses Mal treffen wir uns wieder in den Räumen der CoreMedia AG in der Ludwig-Erhard-Straße 18 in 20459 Hamburg (3.OG). Da wir in den Räumlichkeiten einen Beamer zur Verfügung haben hat jeder Teilnehmer die Möglichkeit einen kurzen Vortrag (Format: Lightning Talks oder etwas länger) zu halten. Konkrete Vorträge ergeben sich erfahrungsgemäß vor Ort. Eingeladen ist wie immer jeder der Interesse hat sich mit anderen Djangonauten auszutauschen. Eine Anmeldung ist nicht erforderlich. Weitere Informationen über die UserGroup gibt auf unserer Webseite www.dughh.de. -
My Thoughts on DjangoConUS 2012
As I'm sitting in DCA with an hour delayed flight, I thought I should share some of my thoughts to my first DjangoCon, which was actually my first technical conference of any sort. In no particular order, I'll discuss the event categorically. These views are from my point of view as an attendee. Location Washington, D.C. (well, Arlington, VA technically) seemed like a fine location. I was able to arrive a couple days early and visit some of the national monuments and museums. This was a pretty cool experience because I've never been to D.C. before. Seeing all the the iconic sights of my nation's capitol was very interesting. I really enjoyed the Smithsonian museums that I had time to go to which included American History, Air and Space, and the American Indian Museum. All three of these venues had some awesome collections, all paid for by American tax dollars too, so you might as well go see them! The Hyatt Crystal City was an excellent hotel, the rooms were modern and clean, the ballrooms and conference areas fit our needs fine, although the Track 2 room was a bit on the smaller side. The catered lunches (via the Hyatt … -
Dissecting Phonegap's architecture
Apache Cordova is a open source cross-platform framework for building native mobile applications using HTML, CSS and JavaScript. It started off as Phonegap, a project of Nitobi Software before it was acquired by Adobe Systems. The code for the platform was donated to the Apache Software foundation and is currently being incubated as "Apache Cordova". Phonegap is now a distribution of Apache Cordova (analogous to Ubuntu being a Linux distribution) brought to you by Adobe. Since Apache Cordova is licensed under the permissive Apache Software License, Adobe Phonegap may technically be integrated with proprietary software (though there's no evidence for the same yet). This post is not going to discuss how to build a cross-platform mobile app using Phonegap and if you are here expecting that, you are better off checking their docs. In this post, we are going to see how Phonegap apps work ie how the javascript component is able to communicate with the native APIs and vice-versa. The Cordova guys have taken a lot of pain keep a consistent JS interface on the client side but underneath there is a large divergence between each platform. We are going to discuss the architectures of android and iOS since … -
Real-timify Django with SockJS
In yesterdays DjangoCon BDFL Keynote Adrian Holovaty called out that Django needs a Real-Time story. Well, here's a response to that: django-sockjs-tornado Immediately after the keynote I went and found a comfortable chair and wrote this app. It's basically a django app that allows you to run a socketserver with manage.py like this: python manage.py socketserver Now, you can use all of SockJS to write some really flashy socket apps. In Django! Using Django models and stuff. The example included shows how to write a really simple chat application using Django models. check out the whole demo here If you're curious about SockJS read the README and here's one of many good threads about the difference between SockJS and socket.io. The reason I could write this app so quickly was because I have already written a production app using sockjs-tornado so the concepts were familiar. However, this app has (at the time of writing) not been used in any production. So mind you it might still need some more love before you show your mom your django app with WebSockets. -
Levee (dike) experiments website
In the Netherlands, we're holding levee (dike) experiments at the IJkdijk location. Two levees have been build, stuffed full with various sensors. The goal? To get those levees to break and to validate which sensors provide useful monitoring data. There are two types of failure which they're testing: Piping. A sand layer is placed under the levee where water can seep through, undermining the levee. Macro stability. Tanks of water are placed on top of the levee, pushing water into the inner part of the levee. After a while, the pressure is too big and the levee will burst/collapse/fail. All those monitors are connected to a central database. We (Nelen & Schuurmans) participated together with Fugro. Fugro loaded the data into their Geodin database, we showed the data in a website using our Lizard (build with Django) framework. What we used a lot: the Flot javascript graph library for beautiful graphs. The website is only accessible on the experiment location itself, so I made myself a short movie so you can get an idea anyway: -
Announcing djangonauts.org
This morning during the DjangoCon US Lightning Talks, I announced the launch of djangonauts.org, a directory of Django user groups worldwide. Any and all Django user groups are welcome to visit the site and list their site for free. In addition, if your user group does not have an ... -
The missing library: ad-hoc queries for your models
I think it would be great if more sites allowed users (or consumers of their APIs) to produce and execute ad-hoc queries against their data. In this post I'll talk a little bit about some ways sites are currently doing this, some of the challenges involved, my experience trying to build something "reusable", and finally invite you to share your thoughts. A few popular ways of doing ad-hoc queries The Advanced search form One easy way to express an ad-hoc query is with an "advanced search" form, which provides full-text search and numerous options to narrow the results -- as a web-monkey who has coded up quite a few of these, I can say that in the simple case they are quite easy to write and usually consist of a series of if statements that build up the WHERE clause of a query. When the result set is very large it can also be useful to pair advanced search with drill-down. Building good drill-down search can be hard work as you need to compute "summary" information for various facets of your result set. Advanced search combined with drill-down is something I see on all the big e-commerce sites. It seems … -
DjangoCon 2012 Slides For "API Design Tips"
DjangoCon 2012 Slides For "API Design Tips" -
Thoughts on my stack
I'm an open source developer. I use Python, Django, PostgreSQL, JQuery, MongoDB, Memcached, and Redis. I push production code to Linux servers. And yet: My laptop runs Apple's Mac OS X. My primary editor is Sublime Text. My production servers are provided mostly by Heroku. All my sites are hosted on Amazon EC2. I've got nothing against Apple, Heroku, or Amazon, but their tools are not open source. And that's food for thought. -
Thoughts on my stack
I'm an open source developer. I use Python, Django, PostgreSQL, JQuery, MongoDB, Memcached, and Redis. I push production code to Linux servers. And yet: My laptop runs Apple's Mac OS X. My primary editor is Sublime Text. My production servers are provided mostly by Heroku. All my sites are hosted on Amazon EC2. I've got nothing against Apple, Heroku, or Amazon, but their tools are not open source. And that's food for thought. -
Lỗi khi chạy manage.py createsuperuser
Hôm nay quay lại làm một ứng dụng nhỏ trên Django với môi trường MacOS (Mountain Lion). Mọi thứ có vẻ rất ổn cho đến khi gặp lỗi với dòng lệnh để tạo một superuserpython manager.py createsuperuser Lỗi được hiển thị ra như sau:Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line utility.execute() File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv self.execute(*args, **options.__dict__) File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute output = self.handle(*args, **options) File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 70, in handle default_username = get_default_username() File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 105, in get_default_username default_username = get_system_username() File "/HuyVu/study/workenv/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 85, in get_system_username return getpass.getuser().decode(locale.getdefaultlocale()[1]) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 496, in getdefaultlocale File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 428, in _parse_localename ValueError: unknown locale: UTF-8Hoá ra django không lấy được Locale mặc định của hệ thống. Để khắc phục lỗi này, chúng ta khai báo thêm biến LANG và LC_ALL vào môi trường bằng cách cho thêm 2 dòng sau vào ~/.bash_profileexport LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8Sau đó nhớ kích hoạt sự thay đổi nàysource ~/.bash_profileVà bây giờ có thể thực hiện tạo superuser một cách bình thường.Blog's topic: Lập trìnhBlog's tag: Django -
Django Project Plugin 3.1.3 for Gedit
New fixes to my Django Project Plugin allow for virtualenv and Django 1.4.x -
Better Customer Support with eventlog
In web apps where users are doing various activities in your site, things can get complicated in a hurry that can make troubleshooting both customer support issues as well as exceptions very tricky. Tracking the flow of user activity is critical to understanding what happened and is not always easy to decipher at granular levels through analytics services such as Google Analytics. As a compliment to these services, Eldarion wrote eventlog. It’s a simple pluggable app that you add to your site and then log events throughout your code. The usage of eventlog is pretty simple: from eventlog.models import log log( user=user, action="SOME_ACTION", extra={ "key": "value" } ) Oftentimes, I hook up a bunch of signal receivers from external apps just for logging various activity on the site. In this above contrived example, user is optional, but if you supply it, it should be an authenticated user. The action is what is used in the Django admin for filtering, so give some consideration in naming. I typically prefix similar actions, or actions from the same app, with the same prefix so they are visually grouped together in the filter list. This is especially important as the number of different actions increase. … -
Thoughts on my stack
I'm an open source developer. I use Python, Django, PosgreSQL, JQuery, MongoDB, Memcached, and Redis. I push production code to Linux servers. And yet: My laptop runs Apple's Mac OS X. My primary editor is Sublime Text. My production servers are provided mostly by Heroku. All my sites are hosted on Amazon EC2. I've got nothing against Apple, Heroku, or Amazon, but their tools are not open source. And that's food for thought. -
Caktus Team Members Presenting at DjangoCon 2012
Caktus is proud to announce that four of our developers will be presenting at this year’s DjangoCon. We are also happy to announce that we will be sponsors of DjangoCon, taking place in Washington D.C. on September 4th through the 7th. In addition to the four Caktus team members who will be presenting this year, our entire development staff will be in attendance enjoying the conference and city. Karen Tracey and myself will be presenting a talk OpenBlock: Overview and Initial Experience about the implementation of OpenBlock for the OpenRural project. OpenBlock, released to the community from the Knight-funded project, EveryBlock, is a neighborhood news project aiming to provide a framework for hyper-local civic data. Over the past few years, the open source project has been maintained by the non-profit OpenPlans. OpenBlock is not available in every city so we worked with Ryan Thornburg of the UNC School of Journalism and Mass communications to bring OpenBlock to rural North Carolina newspapers by implementing OpenRural. This talk will focus on Colin and Karen’s experience with OpenBlock as they work to deploy OpenRural in North Carolina Mark Lavin will be giving a talk entitled Maintaining Your Sanity While Maintaining Your Open Source … -
Aiding tests with Ludibrio stubs and mocks
In tests we assume some input data and check if the output is equal to what we expect it to be. Sometimes is impossible to set the initial data as the code fetches some data from a third party API, or creates some data on its own (like random data). To aid testing of such code we can use ludibrio. It can mock or stub existing classes or functions making them work as we program it. -
Заметки с DjangoCon 2011
Выдалось немножко свобдного времени, решил набросать быстрых заметок про DjangoCon 2011 в Потленде. Признание Я не хотел ехать на конференцию сначала. Потому что последние полгода-год всё связанное с Джанго, Питоном, интернетом, да и вообще компьютерами стало навевать на меня тоску. Да и конференции со временем утратили очарование новизны: приехал, послушал доклады, которые лучше было бы прочитать текстом, уехал — только время потерял. Однако потом передумал, потому что… да просто потому что Портленд от меня теперь в трёх-четырёх часах езды. Как теперь потихоньку понимаю, передумал не зря. Похоже, эта конференция пропитана каким-то особым духом Хабанбай-Батыра, и я снова начинаю получать удовольствие от происходящего :-). Я наконец понял, что надо не доклады слушать, а с людьми разговаривать :-). Организация Главный организатор конференции — Стивен Холден, председатель PSF, который на этом деле собаку съел (PyCon тоже он организует). Результат — организация на уровне Just Works® с отсутствием каких бы то ни было заметных проблем: DjangoCon оплачивает всем участникам отельный WiFi, так как сами отели пока ещё не додумались, что это людям несколько важнее трёх комплектов полотенец в одноместном номере. В конференц-залах работает отдельный WiFi, без которого отельная сеть бы загнулась. Он всё же иногда мигает, но довольно редко. В конференцию входит завтрак, обед …