本文整理汇总了Python中environ.Env.search_url_config方法的典型用法代码示例。如果您正苦于以下问题:Python Env.search_url_config方法的具体用法?Python Env.search_url_config怎么用?Python Env.search_url_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类environ.Env
的用法示例。
在下文中一共展示了Env.search_url_config方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_common_args_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_common_args_parsing(self):
excluded_indexes = 'myapp.indexes.A,myapp.indexes.B'
include_spelling = 1
batch_size = 100
params = 'EXCLUDED_INDEXES=%s&INCLUDE_SPELLING=%s&BATCH_SIZE=%s' % (
excluded_indexes,
include_spelling,
batch_size
)
for url in [
self.solr_url,
self.elasticsearch_url,
self.whoosh_url,
self.xapian_url,
self.simple_url,
]:
url = '?'.join([url, params])
url = Env.search_url_config(url)
self.assertTrue('EXCLUDED_INDEXES' in url.keys())
self.assertTrue('myapp.indexes.A' in url['EXCLUDED_INDEXES'])
self.assertTrue('myapp.indexes.B' in url['EXCLUDED_INDEXES'])
self.assertTrue('INCLUDE_SPELLING'in url.keys())
self.assertTrue(url['INCLUDE_SPELLING'])
self.assertTrue('BATCH_SIZE' in url.keys())
self.assertEqual(url['BATCH_SIZE'], 100)
示例2: test_xapian_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_xapian_parsing(self):
flags = 'myflags'
url = '%s?FLAGS=%s' % (self.xapian_url, flags)
url = Env.search_url_config(url)
self.assertEqual(url['ENGINE'], 'haystack.backends.xapian_backend.XapianEngine')
self.assertTrue('PATH' in url.keys())
self.assertEqual(url['PATH'], '/home/search/xapian_index')
self.assertTrue('FLAGS' in url.keys())
self.assertEqual(url['FLAGS'], flags)
self.assertTrue('INDEX_NAME' not in url)
示例3: test_elasticsearch_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_elasticsearch_parsing(self):
timeout = 360
url = '%s?TIMEOUT=%s' % (self.elasticsearch_url, timeout)
url = Env.search_url_config(url)
self.assertEqual(url['ENGINE'], 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine')
self.assertTrue('INDEX_NAME' in url.keys())
self.assertEqual(url['INDEX_NAME'], 'index')
self.assertTrue('TIMEOUT' in url.keys())
self.assertEqual(url['TIMEOUT'], timeout)
self.assertTrue('PATH' not in url)
示例4: test_solr_multicore_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_solr_multicore_parsing(self):
timeout = 360
index = 'solr_index'
url = '%s/%s?TIMEOUT=%s' % (self.solr_url, index, timeout)
url = Env.search_url_config(url)
self.assertEqual(url['ENGINE'], 'haystack.backends.solr_backend.SolrEngine')
self.assertEqual(url['URL'], 'http://127.0.0.1:8983/solr/solr_index')
self.assertEqual(url['TIMEOUT'], timeout)
self.assertTrue('INDEX_NAME' not in url)
self.assertTrue('PATH' not in url)
示例5: test_whoosh_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_whoosh_parsing(self):
storage = 'file' # or ram
post_limit = 128 * 1024 * 1024
url = '%s?STORAGE=%s&POST_LIMIT=%s' % (self.whoosh_url, storage, post_limit)
url = Env.search_url_config(url)
self.assertEqual(url['ENGINE'], 'haystack.backends.whoosh_backend.WhooshEngine')
self.assertTrue('PATH' in url.keys())
self.assertEqual(url['PATH'], '/home/search/whoosh_index')
self.assertTrue('STORAGE' in url.keys())
self.assertEqual(url['STORAGE'], storage)
self.assertTrue('POST_LIMIT' in url.keys())
self.assertEqual(url['POST_LIMIT'], post_limit)
self.assertTrue('INDEX_NAME' not in url)
示例6: test_simple_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_simple_parsing(self):
url = Env.search_url_config(self.simple_url)
self.assertEqual(url['ENGINE'], 'haystack.backends.simple_backend.SimpleEngine')
self.assertTrue('INDEX_NAME' not in url)
self.assertTrue('PATH' not in url)
示例7: test_solr_parsing
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import search_url_config [as 别名]
def test_solr_parsing(self):
url = Env.search_url_config(self.solr_url)
self.assertEqual(url['ENGINE'], 'haystack.backends.solr_backend.SolrEngine')
self.assertEqual(url['URL'], 'http://127.0.0.1:8983/solr')