• djangosphinx 的使用


    搜索准备用djangosphinx,python manage.py generate_sphinx_config[questions]>>d:\sphinx\bin\sphinx.conf时出现错误

    File "C:\Python27\lib\site-packages\django_sphinx-2.2.4-py2.7.egg\djangosphinx
    \utils\config.py", line 51, in <module>
    'database_engine': _get_database_engine(),
    File "C:\Python27\lib\site-packages\django_sphinx-2.2.4-py2.7.egg\djangosphinx
    \utils\config.py", line 18, in _get_database_engine
    raise ValueError, "Only MySQL and PostgreSQL engines are supported by Sphinx
    ."
    ValueError: Only MySQL and PostgreSQL engines are supported by Sphinx.

    51行为:

    DEFAULT_SPHINX_PARAMS = {
    'database_engine': _get_database_engine(),
    'database_host': settings.DATABASE_HOST,
    'database_port': settings.DATABASE_PORT,
    'database_name': settings.DATABASE_NAME,
    'database_user': settings.DATABASE_USER,
    'database_password': settings.DATABASE_PASSWORD,
    'log_file': '/var/log/sphinx/searchd.log',
    'data_path': '/var/data',
    }

    找到config.py,_get_database_engine函数为:

    def _get_database_engine():
    if settings.DATABASE_ENGINE == 'mysql':
    return settings.DATABASE_ENGINE
    elif settings.DATABASE_ENGINE.startswith('postgresql'):
    return 'pgsql'
    raise ValueError, "Only MySQL and PostgreSQL engines are supported by Sphinx."

    调用了django.conf.setting的DATABASE_ENGINE,用于判断数据库类型,我用的是mysql,将其直接改为

    def _get_database_engine():
    return 'mysql'

    成功。

  • 相关阅读:
    格式化你的git message
    git merge
    Git远程操作详解
    Limit
    EmailService
    RequestContextHolder getHttpServletRequest
    spring boot GlobalExceptionHandler @RestControllerAdvice @ExceptionHandler
    redis 的雪崩和穿透?
    FileUtil
    getWeekDay TimeUtil
  • 原文地址:https://www.cnblogs.com/lddhbu/p/2560425.html
Copyright © 2020-2023  润新知