Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove elasticsearch from settings and requirements
IKarbowiak56ba28513d3e
diff --git a/poetry.lock b/poetry.lockindex b4ed765c07..5ef633fc0e 100644--- a/poetry.lock+++ b/poetry.lock@@ -280,7 +280,6 @@ couchbase = ["couchbase", "couchbase-cffi"]couchdb = ["pycouchdb"]django = ["Django (>=1.8)"]dynamodb = ["boto3 (>=1.4.6)"]-elasticsearch = ["elasticsearch"]eventlet = ["eventlet (>=0.24.1)"]gevent = ["gevent"]librabbitmq = ["librabbitmq (>=1.5.0)"]@@ -512,17 +511,6 @@ version = "0.1.0"[package.dependencies]django-debug-toolbar = ">=2.0"-[[package]]-category = "main"-description = "Wrapper around elasticsearch-dsl-py for django models"-name = "django-elasticsearch-dsl"-optional = false-python-versions = "*"-version = "0.5.1"--[package.dependencies]-elasticsearch-dsl = ">=2.1.0,<6.2.0"-[[package]]category = "dev"description = "Extensions for Django"@@ -792,38 +780,6 @@ urllib3 = "*"[package.extras]dev = ["pre-commit", "pytest", "mock"]-[[package]]-category = "main"-description = "Python client for Elasticsearch"-name = "elasticsearch"-optional = false-python-versions = "*"-version = "6.3.1"--[package.dependencies]-urllib3 = ">=1.21.1"--[package.extras]-develop = ["requests (>=2.0.0,<3.0.0)", "nose", "coverage", "mock", "pyaml", "nosexcover", "sphinx", "sphinx-rtd-theme"]-requests = ["requests (>=2.4.0,<3.0.0)"]--[[package]]-category = "main"-description = "Python client for Elasticsearch"-name = "elasticsearch-dsl"-optional = false-python-versions = "*"-version = "6.0.1"--[package.dependencies]-elasticsearch = ">=6.0.0,<7.0.0"-ipaddress = "*"-python-dateutil = "*"-six = "*"--[package.extras]-develop = ["mock", "pytest (>=3.0.0)", "pytest-cov", "pytz", "sphinx", "sphinx-rtd-theme"]-[[package]]category = "dev"description = "Discover and load entry points from installed packages."@@ -1174,14 +1130,6 @@ zipp = ">=0.5"docs = ["sphinx", "rst.linker"]testing = ["packaging", "importlib-resources"]-[[package]]-category = "main"-description = "IPv4/IPv6 manipulation library"-name = "ipaddress"-optional = false-python-versions = "*"-version = "1.0.23"-[[package]]category = "dev"description = "A Python utility / library to sort Python imports."@@ -2322,7 +2270,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]testing = ["pathlib2", "contextlib2", "unittest2"][metadata]-content-hash = "7670c765c3e1a1291a2e55e849b88adf2a5b3323993d090a65974e9d852f7fe7"+content-hash = "1ee91cd4db26b127e36efae7b61a0611d2e0c8e1d14df02a9cf727276afa1e51"python-versions = "~3.8"[metadata.files]@@ -2552,10 +2500,6 @@ django-debug-toolbar = [django-debug-toolbar-request-history = [{file = "django_debug_toolbar_request_history-0.1.0-py2.py3-none-any.whl", hash = "sha256:b258919bc9f0b863a20783ceda51e4a52c187f93a859de0fcb289423d9aff453"},]-django-elasticsearch-dsl = [- {file = "django-elasticsearch-dsl-0.5.1.tar.gz", hash = "sha256:8c96714d8eef30763e820a2909663b236df765e5c6c8508721489dc9713dfef7"},- {file = "django_elasticsearch_dsl-0.5.1-py2.py3-none-any.whl", hash = "sha256:114889f0f70d584e300953b9fc75f312b447e3ff96136dad03028654ba9f4cbd"},-]django-extensions = [{file = "django-extensions-2.2.5.tar.gz", hash = "sha256:b58320d3fe3d6ae7d1d8e38959713fa92272f4921e662d689058d942a5b444f7"},{file = "django_extensions-2.2.5-py2.py3-none-any.whl", hash = "sha256:a9db7c56a556d244184f589f2437b4228de86ee45e5ebb837fb20c6d54e95ea5"},@@ -2632,14 +2576,6 @@ docutils = [draftjs-sanitizer = [{file = "draftjs-sanitizer-1.0.0.tar.gz", hash = "sha256:4603a9296153cd06d5a1d76a45a1ff0295363516af983d8dde28cafc5cd67583"},]-elasticsearch = [- {file = "elasticsearch-6.3.1-py2.py3-none-any.whl", hash = "sha256:7546cc08e3899716e12fe67d12d7cfe9a64647014d1134b014c3c392b63cad42"},- {file = "elasticsearch-6.3.1.tar.gz", hash = "sha256:aada5cfdc4a543c47098eb3aca6663848ef5d04b4324935ced441debc11ec98b"},-]-elasticsearch-dsl = [- {file = "elasticsearch-dsl-6.0.1.tar.gz", hash = "sha256:8c340995388544662598299a63357acd576579eb939e500956d58a5fd8c17cd1"},- {file = "elasticsearch_dsl-6.0.1-py2.py3-none-any.whl", hash = "sha256:e4254061442fded9721d4ed07db398f66453c402ab60409a2b9a88be433c27ba"},-]entrypoints = [{file = "entrypoints-0.3-py2.py3-none-any.whl", hash = "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19"},{file = "entrypoints-0.3.tar.gz", hash = "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"},@@ -2739,10 +2675,6 @@ importlib-metadata = [{file = "importlib_metadata-0.23-py2.py3-none-any.whl", hash = "sha256:d5f18a79777f3aa179c145737780282e27b508fc8fd688cb17c7a813e8bd39af"},{file = "importlib_metadata-0.23.tar.gz", hash = "sha256:aa18d7378b00b40847790e7c27e11673d7fed219354109d0e7b9e5b25dc3ad26"},]-ipaddress = [- {file = "ipaddress-1.0.23-py2.py3-none-any.whl", hash = "sha256:6e0f4a39e66cb5bb9a137b00276a2eff74f93b71dcbdad6f10ff7df9d3557fcc"},- {file = "ipaddress-1.0.23.tar.gz", hash = "sha256:b7f8e0369580bb4a24d5ba1d7cc29660a4a6987763faf1d8a8046830e020e7e2"},-]isort = [{file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"},{file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"},diff --git a/pyproject.toml b/pyproject.tomlindex 82f91bd4ad..10743e87bf 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -25,7 +25,6 @@ django-babel = "^0"django-bootstrap4 = "~1"django-cache-url = "^3.0"django-countries = "^5.3"-django-elasticsearch-dsl = "^0.5"django-filter = "^2.2"django-graphql-jwt = "<=0.2.1" # https://github.com/mirumee/saleor/issues/4652django-impersonate = "^1.4.1"@@ -42,8 +41,6 @@ django-storages = { version = "^1.7.1", extras = [ "google" ] }django-templated-email = "^2.3.0"django-versatileimagefield = "^1.11"draftjs-sanitizer = "^1.0.0"-elasticsearch = "~6.3.1"-elasticsearch-dsl = "~6.0.1"faker = "^2.0"freezegun = "^0"google-cloud-storage = "^1.18.0"diff --git a/requirements.txt b/requirements.txtindex 4bd7062a56..5035e197de 100644--- a/requirements.txt+++ b/requirements.txt@@ -108,9 +108,6 @@ django-cache-url==3.0.0 \django-countries==5.5 \--hash=sha256:1cefad9ec804d6a0318b91c5394b5aef00336755928f44d0a6420507719d65c8 \--hash=sha256:22e96236101783cfe5222ef5174972242a7e8176336d119a4dc111aedce35897-django-elasticsearch-dsl==0.5.1 \- --hash=sha256:8c96714d8eef30763e820a2909663b236df765e5c6c8508721489dc9713dfef7 \- --hash=sha256:114889f0f70d584e300953b9fc75f312b447e3ff96136dad03028654ba9f4cbddjango-filter==2.2.0 \--hash=sha256:c3deb57f0dd7ff94d7dce52a047516822013e2b441bed472b722a317658cfd14 \--hash=sha256:558c727bce3ffa89c4a7a0b13bc8976745d63e5fd576b3a9a851650ef11c401b@@ -160,12 +157,6 @@ docutils==0.15.2 \--hash=sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99draftjs-sanitizer==1.0.0 \--hash=sha256:4603a9296153cd06d5a1d76a45a1ff0295363516af983d8dde28cafc5cd67583-elasticsearch==6.3.1 \- --hash=sha256:7546cc08e3899716e12fe67d12d7cfe9a64647014d1134b014c3c392b63cad42 \- --hash=sha256:aada5cfdc4a543c47098eb3aca6663848ef5d04b4324935ced441debc11ec98b-elasticsearch-dsl==6.0.1 \- --hash=sha256:8c340995388544662598299a63357acd576579eb939e500956d58a5fd8c17cd1 \- --hash=sha256:e4254061442fded9721d4ed07db398f66453c402ab60409a2b9a88be433c27bafaker==2.0.4 \--hash=sha256:48c03580720e0b46538d528b1296e4e5b24a809dcaf33a7dddec719489a9edb8 \--hash=sha256:6327c665c0d8721280b3036d9c9e851c60092bc1f30c8394cc433f8723e2bda5@@ -224,9 +215,6 @@ idna==2.8 \importlib-metadata==0.23 \--hash=sha256:d5f18a79777f3aa179c145737780282e27b508fc8fd688cb17c7a813e8bd39af \--hash=sha256:aa18d7378b00b40847790e7c27e11673d7fed219354109d0e7b9e5b25dc3ad26-ipaddress==1.0.23 \- --hash=sha256:6e0f4a39e66cb5bb9a137b00276a2eff74f93b71dcbdad6f10ff7df9d3557fcc \- --hash=sha256:b7f8e0369580bb4a24d5ba1d7cc29660a4a6987763faf1d8a8046830e020e7e2jinja2==2.10.3 \--hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \--hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527dediff --git a/requirements_dev.txt b/requirements_dev.txtindex 4d44805dad..317f330b32 100644--- a/requirements_dev.txt+++ b/requirements_dev.txt@@ -182,9 +182,6 @@ django-debug-toolbar==2.1 \--hash=sha256:77cfba1d6e91b9bc3d36dc7dc74a9bb80be351948db5f880f2562a0cbf20b6c5django-debug-toolbar-request-history==0.1.0 \--hash=sha256:b258919bc9f0b863a20783ceda51e4a52c187f93a859de0fcb289423d9aff453-django-elasticsearch-dsl==0.5.1 \- --hash=sha256:8c96714d8eef30763e820a2909663b236df765e5c6c8508721489dc9713dfef7 \- --hash=sha256:114889f0f70d584e300953b9fc75f312b447e3ff96136dad03028654ba9f4cbddjango-extensions==2.2.5 \--hash=sha256:b58320d3fe3d6ae7d1d8e38959713fa92272f4921e662d689058d942a5b444f7 \--hash=sha256:a9db7c56a556d244184f589f2437b4228de86ee45e5ebb837fb20c6d54e95ea5@@ -240,12 +237,6 @@ docutils==0.15.2 \--hash=sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99draftjs-sanitizer==1.0.0 \--hash=sha256:4603a9296153cd06d5a1d76a45a1ff0295363516af983d8dde28cafc5cd67583-elasticsearch==6.3.1 \- --hash=sha256:7546cc08e3899716e12fe67d12d7cfe9a64647014d1134b014c3c392b63cad42 \- --hash=sha256:aada5cfdc4a543c47098eb3aca6663848ef5d04b4324935ced441debc11ec98b-elasticsearch-dsl==6.0.1 \- --hash=sha256:8c340995388544662598299a63357acd576579eb939e500956d58a5fd8c17cd1 \- --hash=sha256:e4254061442fded9721d4ed07db398f66453c402ab60409a2b9a88be433c27baentrypoints==0.3 \--hash=sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19 \--hash=sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451@@ -319,9 +310,6 @@ idna==2.8 \importlib-metadata==0.23 \--hash=sha256:d5f18a79777f3aa179c145737780282e27b508fc8fd688cb17c7a813e8bd39af \--hash=sha256:aa18d7378b00b40847790e7c27e11673d7fed219354109d0e7b9e5b25dc3ad26-ipaddress==1.0.23 \- --hash=sha256:6e0f4a39e66cb5bb9a137b00276a2eff74f93b71dcbdad6f10ff7df9d3557fcc \- --hash=sha256:b7f8e0369580bb4a24d5ba1d7cc29660a4a6987763faf1d8a8046830e020e7e2isort==4.3.21 \--hash=sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd \--hash=sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1diff --git a/saleor/core/context_processors.py b/saleor/core/context_processors.pyindex 9dfdade016..0736ac7fa9 100644--- a/saleor/core/context_processors.py+++ b/saleor/core/context_processors.py@@ -13,7 +13,3 @@ def get_setting_as_dict(name, short_name=None):# pylint: disable=W0613def default_currency(request):return get_setting_as_dict("DEFAULT_CURRENCY")---def search_enabled(request):- return {"SEARCH_IS_ENABLED": settings.ENABLE_SEARCH}diff --git a/saleor/core/management/commands/populatedb.py b/saleor/core/management/commands/populatedb.pyindex b75e68755e..e17cd45143 100644--- a/saleor/core/management/commands/populatedb.py+++ b/saleor/core/management/commands/populatedb.py@@ -1,7 +1,6 @@from io import StringIOfrom django.apps import apps-from django.conf import settingsfrom django.core.management import call_commandfrom django.core.management.base import BaseCommandfrom django.db import connection@@ -67,10 +66,6 @@ class Command(BaseCommand):cursor.execute("PRAGMA temp_store = MEMORY;")cursor.execute("PRAGMA synchronous = OFF;")- def populate_search_index(self):- if settings.ES_URL:- call_command("search_index", "--rebuild", force=True)-def sequence_reset(self):"""Run a SQL sequence reset on all saleor.* apps.@@ -116,7 +111,5 @@ class Command(BaseCommand):msg = create_superuser(credentials)self.stdout.write(msg)add_address_to_admin(credentials["email"])- if not options["withoutsearch"]:- self.populate_search_index()if not options["skipsequencereset"]:self.sequence_reset()diff --git a/saleor/seo/schema/webpage.py b/saleor/seo/schema/webpage.pydeleted file mode 100644index fb9ded7b17..0000000000--- a/saleor/seo/schema/webpage.py+++ /dev/null@@ -1,28 +0,0 @@-from urllib.parse import urljoin--from django.conf import settings-from django.contrib.sites.shortcuts import get_current_site-from django.urls import reverse--from ...core.utils import build_absolute_uri---def get_webpage_schema(request):- """Build a schema.org representation of the website."""- site = get_current_site(request)- url = build_absolute_uri(location="/")- data = {- "@context": "http://schema.org",- "@type": "WebSite",- "url": url,- "name": site.name,- "description": site.settings.description,- }- if settings.ENABLE_SEARCH:- search_url = urljoin(url, reverse("search:search"))- data["potentialAction"] = {- "@type": "SearchAction",- "target": "%s?q={q}" % search_url,- "query-input": "required name=q",- }- return datadiff --git a/saleor/settings.py b/saleor/settings.pyindex 09974d930f..82ff5d4625 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -166,7 +166,6 @@ context_processors = ["django.template.context_processors.request","saleor.core.context_processors.default_currency","saleor.checkout.context_processors.checkout_counter",- "saleor.core.context_processors.search_enabled","saleor.site.context_processors.site","social_django.context_processors.backends","social_django.context_processors.login_redirect",@@ -511,25 +510,8 @@ DEFAULT_PLACEHOLDER = "images/placeholder255x255.png"LOGOUT_ON_PASSWORD_CHANGE = False-# SEARCH CONFIGURATION-DB_SEARCH_ENABLED = True--# support deployment-dependant elastic environment variable-ES_URL = (- os.environ.get("ELASTICSEARCH_URL")- or os.environ.get("SEARCHBOX_URL")- or os.environ.get("BONSAI_URL")-)--ENABLE_SEARCH = bool(ES_URL) or DB_SEARCH_ENABLED # global search disabling-SEARCH_BACKEND = "saleor.search.backends.postgresql"-if ES_URL:- SEARCH_BACKEND = "saleor.search.backends.elasticsearch"- INSTALLED_APPS.append("django_elasticsearch_dsl")- ELASTICSEARCH_DSL = {"default": {"hosts": ES_URL}}-AUTHENTICATION_BACKENDS = ["saleor.account.backends.facebook.CustomFacebookOAuth2","saleor.account.backends.google.CustomGoogleOAuth2",diff --git a/tests/settings.py b/tests/settings.pyindex 30bb31adda..18d9febeba 100644--- a/tests/settings.py+++ b/tests/settings.py@@ -1,10 +1,8 @@import re+from typing import List, Pattern, Unionfrom django.utils.functional import SimpleLazyObject-from typing import List, Pattern, Union-# pylint: disable=W0401, W0614-# flake8: noqafrom saleor.settings import * # noqa@@ -33,9 +31,7 @@ DEFAULT_CURRENCY = "USD"TIME_ZONE = "America/Chicago"LANGUAGE_CODE = "en"-ES_URL = NoneSEARCH_BACKEND = "saleor.search.backends.postgresql"-INSTALLED_APPS = [a for a in INSTALLED_APPS if a != "django_elasticsearch_dsl"]EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"