def ask_db_info(self, name='default'):
        print "Configuring database connection: %s" % name
        info = {
            'conn_name': name,
            'ENGINE': raw_input('Database type (mysql, postgres or sqlite3): ')
        }
        if info['ENGINE'] not in ['mysql', 'postgres', 'sqlite3']:
            raise RuntimeError('Unsupported database engine')

        if info['ENGINE'] == 'sqlite3':
            info['ENGINE'] = 'django.db.backends.sqlite3'
            info['NAME'] = '%s.db' % name
            return info
        if info['ENGINE'] == 'postgres':
            info['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
            default_port = 5432
        else:
            info['ENGINE'] = 'django.db.backends.mysql'
            default_port = 3306
        info['HOST'] = raw_input("Database host (default: 'localhost'): ")
        info['PORT'] = raw_input(
            "Database port (default: '%s'): " % default_port)
        # leave port setting empty, if default value is supplied and
        # leave it to django
        if info['PORT'] == default_port:
            info['PORT'] = ''
        info['NAME'] = raw_input('Database name: ')
        info['USER'] = raw_input('Username: ')
        info['PASSWORD'] = getpass.getpass('Password: ')
        return info
Prompt the user for database information
dataset/ETHPy150Open tonioo/modoboa/modoboa/core/commands/deploy.py/DeployCommand.ask_db_info