So I have been adding some of the static pages to the CQIL website. It is a fun job with Django — editing some templates and pulling in the data from the db. Easy. Simple, but no simpler than it should be. Or is that so?
How can we make web-dev simpler?
Let’s figure out what we want first:
- Rapid develeopment
- No repetition of work
- Using standards (easy to learn, portable knowledge)
- Extensibility (framework should help you do the easy stuff, but get out of the way when you want to do custom stuff)
- Editable through the web
- Easy
I want to focus on the last point. In particular, given that there are several people involved in the construction of the website, each of these people’s tasks has to be as easy as possible. For the sake of simplicity I will use only three roles for my explanation:
Web-dev roles
- Programmer: (knows:python,php,ruby,mysql…) backend, frontend, db, everything you can think about. Dev, maintenance, optimization, deployment.
- Designer: (knows:photoshop, css, typography+ a little js) Is responsible for the site layout, usability, he/she must produce the css and the associated images.
- Content Writer: (knows: English) This person will produce all the content on the website. Articles, about-pages, news items, product descriptions.
Ex1: wordpress
The programmer is the wordpress team. The designer is the wordpress team or some other site where you can download wordpress themes. The content writer is you. It is a pretty sweet deal too since the whole stack is free :)
What makes wordpress work so well is that there is essentially one content type: the blog entry. So we have a very targeted CMS with rich features well targeted to help you write/maintain you blog. Great if you want to write a blog. Not so great if you want to write something else… like journal for example, or a gamebook.
Ex2: Plone+Zope
Here the programmers are the Plone+Zope team which have produced a lot of different content types like events, articles, news briefs, web pages, etc… If you want you can create your own content types (good luck! this might help).
The designer’s job… oooh boy… poor designer who will have to learn A LOT about the internals of Plone and write a ton of XML files to overwrite the default stylesheets. Also — and above all, I am questioning how efficiently he/she can do her job when all she is allowed to do is move around the servelets and portlets.
As for the content writer — hey he get’s a sweet deal with a very rich set of content types that will probably do 90% of the things he wants to do. He can edit things with point and click. Yeeey CMS done right!
Ex3: drupal or joomla or some other CMS
I don’t know enough about these to make an opinion but my guess is that they have similar problems to the Plone stack. Too much complication for the programmer/designer. This is of course not an issue if you spend a few months learning about the internals — surely then you will be a lean mean content type producing machine and will be able to handle lots of contracts from high paying clients :)
I should look into these one day …
Ex4: django
Django goes a LONG way towards the goal. In particular there is a split between the designer’s job (write templates) and the programmer’s job (write views). I can’t say I am a big fan of the django templating language — but I will say that it was very easy to learn and it had every construct I ever needed and nothing more. I guess ANY templating language that has good documentation and examples (like the django docs) is good enough for the task.
So while Django is nearly there there as far as the perfect web-dev platform requirements go, it is still not perfect. In particular these are the kinds of things I would like to have:
- More intelligent blocks/inherit/includes in the templates
- An interface between the content writer and the designer
- An interface between programmer & designer (right now I put as the second line of my template comments like: {# REQS: person_list, page_title #}, which tell me which variables are required for this template.
- Something that writes javascript for me :)
- Widgets for each field type like Plone has
- Through the web editing of everything like web.py
I am not saying these should be included in Django per-se. It would be perfectly fine if these are external projects. If I had time, I would work on this precisely, because the availability of a front-end framework for UI stuff can really make a difference for fast development.
So what DO I want specifically…
Here is what I envision as the “ideal scenario”.
1/ The programmer meets with the client and figures out what content types will be needed and how the site will work in general.
2/ The designer is given “building clocks” like div id=”homepage_text” and div id=”homepage_sidebar1″ with lorem impsum etc. instead of real content. He produces the layout working only with these blocks and changes the “sample” text to include examples of special functionality like ul’s that are actually the site navigational menu. etc…
3/ The content writer visits the page and edits-in-place the same building blocks using some simple markup language like ReST, Markdown or a wiki variety.
The essential thing I want is that all three parties can communicate using the same reference the “building blocks”. This would make the design super modular — I think and help with rapid development and code reuse.
For example, this is how I would like the homepage of the CQIL website to be rendered. First there is some general “top level” template base.html and the content-only file something like
/cqil/content/homepage.ReST
{% extends "two_column_layout.html" %}
{% block leftcolumn %}
{% filter restructuredtext %}
Welcome
=======
this is the homepage... alsjkalksj alks jaklj
{% endfilter %}
{% endblock %}
as you can see, there is an intermediary “connecting” template that produces the two column layout. This makes for VERY simple editing by the content writer if he/she had change the content.
Wow… I am pretty impressed. As I was writing this post I figured out that half of what I want is already possible with Django out of the box! Sweet.
What is missing then — well some javascript code to allow editing of the blocks though the web. This will be done with Jeditable next time I sit down to work on this. And I need to figure out where exactly I want the div-text to be stored. In the database? Sure that would be nice… but filesystem is also nice since you can edit with vim and or WebDAV. Can there be two versions — one on disk and one on db that mirror each other? If you change on disk it updates the db, if you change through the web it outputs a new version to the fs. Hmm… clearly some notion of version control is necessary like in wikis.
Ok… enough of this brainstorming. Good ideas… more code necessary ;)