Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update search index after populating database
Artur Smęt71fc19d41114
diff --git a/saleor/core/management/commands/populatedb.py b/saleor/core/management/commands/populatedb.pyindex dceb2650ca..5314b587ec 100644--- a/saleor/core/management/commands/populatedb.py+++ b/saleor/core/management/commands/populatedb.py@@ -1,3 +1,4 @@+from django.core.management import call_commandfrom django.core.management.base import BaseCommandfrom django.db import connection@@ -23,6 +24,12 @@ class Command(BaseCommand):dest='withoutimages',default=False,help='Don\'t create product images')+ parser.add_argument(+ '--withoutsearch',+ action='store_true',+ dest='withoutsearch',+ default=False,+ help='Don\'t update search index')def make_database_faster(self):'''Sacrifices some of the safeguards of sqlite3 for speed@@ -35,6 +42,9 @@ class Command(BaseCommand):cursor.execute('PRAGMA temp_store = MEMORY;')cursor.execute('PRAGMA synchronous = OFF;')+ def populate_search_index(self):+ call_command('update_index')+def handle(self, *args, **options):self.make_database_faster()create_images = not options['withoutimages']@@ -60,3 +70,5 @@ class Command(BaseCommand):else:self.stdout.write('Superuser already exists - %(email)s' % credentials)+ if not options['withoutsearch']:+ self.populate_search_index()