Пример #1
0
def optimal_depcheck():
    optimal = []

    if not depcheck.test_db():
        if depcheck.test_mysqldb():
            text = _("Using the default sqlite3 database engine. SQLite is "
                     "only suitable for small installations with a small "
                     "number of users. Pootle will perform better with the "
                     "MySQL database engine.")
        else:
            text = _("Using the default sqlite3 database engine. SQLite is "
                     "only suitable for small installations with a small "
                     "number of users. Pootle will perform better with the "
                     "MySQL database engine, but you need to install "
                     "python-MySQLdb first.")
        optimal.append({'dependency': 'db', 'text': text})

    if not depcheck.test_session():
        text = _("For optimal performance, use django.contrib."
                 "sessions.backends.cached_db as the session "
                 "engine.")
        optimal.append({'dependency': 'session', 'text': text})
    if not depcheck.test_webserver():
        optimal.append({
            'dependency':
            'webserver',
            'text':
            _("For optimal performance, use Apache as the webserver.")
        })
    if not depcheck.test_from_email():
        optimal.append({
            'dependency':
            'from_email',
            'text':
            _('The "from" address used to send registration emails is '
              'not specified. Also review the mail server settings.')
        })
    if not depcheck.test_contact_email():
        optimal.append({
            'dependency':
            'contact_email',
            'text':
            _("No contact address is specified. The contact form will "
              "allow users to contact the server administrators.")
        })
    if not depcheck.test_debug():
        optimal.append({
            'dependency':
            'debug',
            'text':
            _("Running in debug mode. Debug mode is only needed when "
              "developing Pootle. For optimal performance, disable "
              "debugging mode.")
        })

    return optimal
Пример #2
0
def optimal_depcheck():
    optimal = []

    if not depcheck.test_db():
        if depcheck.test_mysqldb():
            text = _("Using the default sqlite3 database engine. SQLite is only suitable for small installations with a small number of users. Pootle will perform better with the MySQL database engine.")
        else:
            text = _("Using the default sqlite3 database engine. SQLite is only suitable for small installations with a small number of users. Pootle will perform better with the MySQL database engine, but you need to install python-MySQLdb first.")
        optimal.append({'dependency': 'db', 'text': text})

    if depcheck.test_cache():
        if depcheck.test_memcache():
            if not depcheck.test_memcached():
                # memcached configured but connection failing
                optimal.append({'dependency': 'cache',
                                'text': _("Pootle is configured to use memcached as a caching backend, but can't connect to the memcached server. Caching is currently disabled.")})
            else:
                if not depcheck.test_session():
                    if depcheck.test_cached_db_session():
                        text = _('For optimal performance, use django.contrib.sessions.backends.cached_db as the session engine.')
                    else:
                        text =  _('For optimal performance, use django.contrib.sessions.backends.cache as the session engine.')
                    optimal.append({'dependency': 'session', 'text': text})
        else:
            optimal.append({'dependency': 'cache',
                            'text': _('Pootle is configured to use memcached as caching backend, but Python support for memcached is not installed. Caching is currently disabled.')})
    else:
        optimal.append({'dependency': 'cache',
                        'text': _('For optimal performance, use memcached as the caching backend.')})

    if not depcheck.test_webserver():
        optimal.append({'dependency': 'webserver',
                        'text': _("For optimal performance, use Apache as the webserver.")})
    if not depcheck.test_from_email():
        optimal.append({'dependency': 'from_email',
                        'text': _('The "from" address used to send registration emails is not specified. Also review the mail server settings.')})
    if not depcheck.test_contact_email():
        optimal.append({'dependency': 'contact_email',
                        'text': _("No contact address is specified. The contact form will allow users to contact the server administrators.")})

    if not depcheck.test_debug():
        optimal.append({'dependency': 'debug',
                        'text': _('Running in debug mode. Debug mode is only needed when developing Pootle. For optimal performance, disable debugging mode.')})

    if not depcheck.test_livetranslation():
        optimal.append({'dependency': 'livetranslation',
                       'text': _("Running in live translation mode. Live translation is useful as a tool to learn about Pootle and localization, but has high impact on performance.")})

    return optimal