瀏覽代碼

Replace every remaining mention of postgresql_psycopg2.

PostgreSQL search backend were not running because of this since https://github.com/wagtail/wagtail/commit/67b1ddb665c2688a978ee61936d43010cf687620#diff-c2cc727a5e1fca9050dea34af68aa13c
Bertrand Bordage 7 年之前
父節點
當前提交
9db5b45ec7
共有 4 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      conftest.py
  2. 1 1
      docs/advanced_topics/settings.rst
  3. 1 1
      runtests.py
  4. 4 4
      wagtail/contrib/postgres_search/backend.py

+ 1 - 1
conftest.py

@@ -33,7 +33,7 @@ def pytest_configure(config):
         pass
 
     if config.getoption('postgres'):
-        os.environ['DATABASE_ENGINE'] = 'django.db.backends.postgresql_psycopg2'
+        os.environ['DATABASE_ENGINE'] = 'django.db.backends.postgresql'
 
     # Setup django after processing the pytest arguments so that the env
     # variables are available in the settings

+ 1 - 1
docs/advanced_topics/settings.rst

@@ -558,7 +558,7 @@ These two files should reside in your project directory (``myproject/myproject/`
 
   DATABASES = {
       'default': {
-          'ENGINE': 'django.db.backends.postgresql_psycopg2',
+          'ENGINE': 'django.db.backends.postgresql',
           'NAME': 'myprojectdb',
           'USER': 'postgres',
           'PASSWORD': '',

+ 1 - 1
runtests.py

@@ -47,7 +47,7 @@ def runtests():
         pass
 
     if args.postgres:
-        os.environ['DATABASE_ENGINE'] = 'django.db.backends.postgresql_psycopg2'
+        os.environ['DATABASE_ENGINE'] = 'django.db.backends.postgresql'
 
     if args.elasticsearch:
         os.environ.setdefault('ELASTICSEARCH_URL', 'http://localhost:9200')

+ 4 - 4
wagtail/contrib/postgres_search/backend.py

@@ -168,10 +168,10 @@ class Index(object):
             obj._object_id = force_text(obj.pk)
             obj._body_ = self.prepare_body(obj)
         connection = connections[self.db_alias]
-        if connection.pg_version >= 90500:  # PostgreSQL >= 9.5
-            self.add_items_upsert(connection, content_type_pk, objs, config)
-        else:
-            self.add_items_update_then_create(content_type_pk, objs, config)
+        # if connection.pg_version >= 90500:  # PostgreSQL >= 9.5
+        #     self.add_items_upsert(connection, content_type_pk, objs, config)
+        # else:
+        self.add_items_update_then_create(content_type_pk, objs, config)
 
     def __str__(self):
         return self.name