This is only the first part of a project to create the simplest (for me) software forum possible.
Here are the features I want:
Login using twitter / Facebook / Google / OpenID
Unlimited number of threads
Support for like / dislike both on threads and on posts
HTML in comments
Mail the user on replies
RSS feeds for threads
You can see it in action at http://foro.netmanagers.com.ar (for a limited time only ;-)
And here is the code:
import bottle import disqusapi as disqus import json shortname = 'magicmisteryforum' api = disqus.DisqusAPI(open("key").read().strip()) @bottle.route('/', method='GET') def index(): msg = bottle.request.GET.get('msg', '') threads = api.forums.listThreads(forum=shortname, limit=100) print threads return bottle.template('main.tpl', threads=threads, shortname=shortname, msg=msg) @bottle.route('/new', method='POST') def new(): title = bottle.request.forms.get('title', None) if not title: bottle.redirect('/?msg=Missing%20Thread%20Name') return thread = api.threads.create(forum=shortname, title = title) thread_id = thread.__dict__['response']['id'] # Redirecting to /thread/thread_id doesn't work # because threads take a few seconds to appear on the listing bottle.redirect('/') @bottle.route('/thread/:id') def thread(id): t = api.threads.details(thread=id) return bottle.template('thread.tpl', shortname=shortname, id=id, thread=t.__dict__['response']) @bottle.route('/static/:path#.+#') def server_static(path): return bottle.static_file(path, root='./static') app = bottle.app() app.catchall = False #Now most exceptions are re-raised within bottle. bottle.run(host='22.214.171.124', port=80, app=app)
OF COURSE I AM CHEATING!
This thing is just a simple veneer around Disqus! More like a blog with comments and without posts than a forum! But ... what's missing to make this a real forum? It works, doesn't it? You could even use Disqus categories to create subforums...
All things considered, I think it's a cute hack.
And if you wait a few days, this will lead to something much more magical!
Full source code at http://magicforum.googlecode.com