@app.route('/<ObjectId:task_id>') def show_task(task_id): task = mongo.db.tasks.find_one_or_404(task_id) return render_template('task.html', task=task)