Skip to content

Instantly share code, notes, and snippets.

@honza
Created August 26, 2012 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save honza/3484384 to your computer and use it in GitHub Desktop.
Save honza/3484384 to your computer and use it in GitHub Desktop.
Django Clojure

Django-like framework in Clojure

The most popular Clojure web framework right now is Noir by far. In my mind, Noir is in the same category as Sinatra and Flask---a microframework that allows you to expose some functionality over HTTP.

I find myself constantly reimplementing the same general-purpose code for every project. Things like authentication, form validation and even ORM are missing from Noir. What I would like to see is a new Clojure framework that is based around similar ideas as Django or Ruby on Rails. I want all the batteries included.

Shopping list

  • Sane, built-in templating language (Jinja2, Mustache)
  • Forms (display, validate, save, csrf protection)
  • ORM (can be fairly simple)
  • Admin interface
  • Pagination
  • E-mail sending

Questions?

Feel free to ask more questions below. If there is a project like this already in the works, please do let me know.

@Raynes
Copy link

Raynes commented Aug 27, 2012

Clojure tends to encourage that almost everything you list be implemented as libraries. It is silly to reimplement these things on a per-app basis -- put them in libraries. They don't have to be stuffed into a big framework. I think Compojure gets it right. Plug things in when you need them, don't tie them all together.

@honza
Copy link
Author

honza commented Aug 27, 2012

Just came across a Rails-like web framework for Clojure called Conjure.

@honza
Copy link
Author

honza commented Aug 27, 2012

@Raynes Sure, if there was a well-defined interface that libraries could hook into, creating framework-specific plugins would be easier. For example, Django only implements the authentication logic; things like user registration and user profiles are available as third party plugins that are really easy to integrate.

@kumarshantanu
Copy link

@honza You should probably look at this: https://github.com/xavi/noir-auth-app

@Raynes
Copy link

Raynes commented Aug 29, 2012

@honza Why does there need to be an 'interface'? What would this interface look like? It seems like ring is the thing we hook into. Middleware, for example. I don't understand what a templating library would want to 'hook into' for example.

@Raynes
Copy link

Raynes commented Aug 29, 2012

Also, to add, don't necessarily look at Noir as the One Canonical Example. Compojure is easily just as popular if not more popular than Noir. Compojure tends to make more sense for more complex things.

@honza
Copy link
Author

honza commented Aug 29, 2012

In Django, you place templates in a specific place and the framework can pick that up. For example, third party apps can provide their own templates which you can customize by overriding the defaults. In general, Django's apps idea is an example of this interface. Each app can provide models, views, urls and other modules.

But I definitely see your point about composing libraries. This way you aren't locked into the framework's way of thinking. In the Python community, lots of people dislike Django because of how big it is and how difficult it is to swap out a part of the architecture (e.g. you might want a different ORM).

@drudru
Copy link

drudru commented May 25, 2013

@honza - did you find something? I want to use clojure and I agree. I want login/auth, and admin-ui, migrations, etc.

did you find anything close?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment