1
# -*- coding: utf-8 -*-
2
# This file is part of the Apps Directory
3
# Copyright (C) 2011-2013 Canonical Ltd.
5
# This program is free software: you can redistribute it and/or modify
6
# it under the terms of the GNU Affero General Public License as
7
# published by the Free Software Foundation, either version 3 of the
8
# License, or (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU Affero General Public License for more details.
15
# You should have received a copy of the GNU Affero General Public License
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
"""Customized runserver command that runs ubuntu-webcatalog's wsgi stack."""
20
from optparse import make_option
21
from django.core.management.commands.runserver import BaseRunserverCommand
22
from django.core.servers.basehttp import AdminMediaHandler
25
class Command(BaseRunserverCommand):
26
option_list = BaseRunserverCommand.option_list + (
28
'--adminmedia', dest='admin_media_path', default='',
29
help='Specifies the directory from which to serve admin media.'),
32
def get_handler(self, *args, **options):
33
"""Serves admin media like old-school (deprecation pending)."""
34
from webcatalog.wsgi import make_app
36
return AdminMediaHandler(handler, options.get('admin_media_path', ''))