Archive for June, 2007

Generate django project API docs

It was not as easy as I expected but I found it out. Creating the a django project’s API doc is pretty easy once you know how! Unfortunately there is a bug in the django integrated doc that you can reach via the admin interface by /admin/doc/ but it is also far less complete (if it would entirely work) than what a pydoc offers.

One problem with both tries the django admin doc and the pydoc was that we are using a lot of decorators for view functions. Decorators such as “login_required” or “transaction.commit_on_success” and the doc generators both either ignored those functions or linked wrong (django admin doc).

So I decided I want the real API docs and done, that is what most devs are best familiar with. But to get that you need to fiddle a little bit with the setup of django and export some variables in order to properly make doc generation work. We used epydoc for generating the docs, it throws out the nice frame-based javadoc like view, I find that quite handy.
Here is how it goes:

  1. export PYTHONPATH=$PYTHONPATH:/Users/wolfram/projectname/trunk/ - extend the python path so that it also find your project
  2. export DJANGO_SETTINGS_MODULE=projectname.settings - set the required django variable
  3. /Library/Frameworks/Python.framework/Versions/2.4/bin/epydoc --html --parse-only --docformat plaintext re -v projectname
    make epydoc generate the docs

epydoc will create a directory named “html” and put all the docs in there, open the index.html in your browser and you are all fine. Happy doc reading …

Comments (3)

Django: nice and critical (article)

I am a django fan and I am using it for a while and very successful in a couple of projects. But reading this article fortunately makes me take a step back and rethink some of the things and be a little more critical with the blindness that sometime just sets in when you are into one topic.

Not that I completely agree with all the points, but it just lets me clear my view a bit. I.e. the template approach of Django is in my eyes a very good one, we (also as developers) don’t want all the power of python in the template, it would just get us into other problems, that other known languages have. And the extensibility of django templates is just very simple and not a reason for me to really complain about it.

Let me say up front I will use Django in my next project again and I think it’s great for quickly coming up to speed and getting things done and to be honest most things are about that. A while ago I developed a very DB intense application, that used a lot of difficult joins and I wouldn’t know if Django would have been the right choice for that. On the other hand I think that some customization would make me able to get all the good stuff Django provides and combine the needs with the luxury.

I actually wanted to list some problematic items that came along my way while working with Django:

  1. no support for aggregation in SQL, we did that all by hand or using triggers or view, which was a quite efficient solution in our case, I am not to unhappy with it
  2. some limitation in the model and SQL building sometimes step on your feet, i.e. creating a n:m relation creates a relational table that can not be adapted in any way, to store additional data in there, which is sometimes needed
  3. Extending the user model is a bit tricky by using the UserProfile approach and actually having two models for user data, we ran into this trap a couple of times. But a possible solution, which we haven’t tried yet but discussed and found to solve the problem was creating a view which provides all the user data as one model and read only from there, that will surely work perfectly and have the advantage that you can even provide additional data that the User and UserProfile models don’t provide. Just be careful to not blow up your DB :-).
  4. The I18N approach of Django is pretty easy to use, but it gets to it’s limits when it gets difficult. Translating strings that are made up of HTML chunks gets difficult.

Don’t see this post as a rant against Django, it’s not meant to be at all. I could probably make a much longer list of advantages.

Comments (12)

I am available again

Yesterday we got to know that the current project is going to be terminated sooner than expected, unfortunately.
We were a great team, with really a perfect mixture of skills, perfect to fulfill all the tasks required, it was great fun, thanks Christian, Daniel, Manfred and Tobi.
Over the last couple of months we had been developing a very innovative Web2.0 project. The core technology we used were:
Django - “Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.”
Dojo - “Dojo allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript sanely.”
MySQL - “The best and the most used database in the world”

I played the role of the technical project manager and developer. I am very comfortable with the above mentioned technologies, like to design the system architecture, structure the work and implement. I just never want to loose touch to the newest technologies.

And now I am on the hunt for a new job, preferably as freelancer, but most important: it has to be innovative, interesting and leading edge technology, that’s where I feel best in. I am currently Munich based, but if you got something to offer at the East coast, New York or some other nice place I can be easily convinced :-).
Contact me at wolfram [at] kriesing [dot] de. I am looking forward for the next big challenge.

Comments