prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Make `pootle webpack` not require system checks
  `pootle webpack` fails if eg the db is not set up/correctly. It would be helpful if it didnt
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pootle/apps/pootle_app/management/commands/webpack.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 #
  3 # Copyright (C) Pootle contributors.
  4 #
  5 # This file is a part of the Pootle project. It is distributed under the GPL3
  6 # or later license. See the LICENSE file for a copy of the license and the
  7 # AUTHORS file for copyright and authorship information.
  8 
  9 import os
  10 os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
  11 import subprocess
  12 import sys
  13 
  14 from django.conf import settings
  15 from django.core.management.base import BaseCommand, CommandError
  16 
  17 from pootle_misc.baseurl import l
  18 
  19 
  20 class Command(BaseCommand):
  21     help = 'Builds and bundles static assets using webpack'
  22 
  23     def add_arguments(self, parser):
  24         parser.add_argument(
  25             '--dev',
  26             action='store_true',
  27             dest='dev',
  28             default=False,
  29             help='Enable development builds and watch for changes.',
  30         )
  31         parser.add_argument(
  32             '--nowatch',
  33             action='store_false',
  34             dest='watch',
  35             default=True,
  36             help='Disable watching for changes.',
  37         )
  38         parser.add_argument(
  39             '--progress',
  40             action='store_true',
  41             default=False,
  42             help='Show progress (implied if --dev is present).',
  43         )
  44         parser.add_argument(
  45             '--extra',
  46             action='append',
  47             default=[],
  48             help='Additional options to pass to the JavaScript webpack tool.',
  49         )
  50 
  51     def handle(self, **options):
  52         default_static_dir = os.path.join(settings.WORKING_DIR, 'static')
  53         custom_static_dirs = filter(lambda x: x != default_static_dir,
  54                                     settings.STATICFILES_DIRS)
  55         default_js_dir = os.path.join(default_static_dir, 'js')
  56 
  57         webpack_config_file = os.path.join(default_js_dir, 'webpack.config.js')
  58 
  59         webpack_bin = os.path.join(default_js_dir, 'node_modules/.bin/webpack')
  60         if os.name == 'nt':
  61             webpack_bin = '%s.cmd' % webpack_bin
  62 
  63         webpack_progress = (
  64             '--progress' if options['progress'] or options['dev'] else ''
  65         )
  66         webpack_colors = '--colors' if not options['no_color'] else ''
  67 
  68         webpack_args = [webpack_bin, '--config=%s' % webpack_config_file]
  69         if webpack_progress:
  70             webpack_args.append(webpack_progress)
  71         if webpack_colors:
  72             webpack_args.append(webpack_colors)
  73 
  74         if options['dev']:
  75             watch = '--watch' if options['watch'] else ''
  76             webpack_args.extend([watch, '--display-error-details'])
  77         else:
  78             os.environ['NODE_ENV'] = 'production'
  79             webpack_args.append("--bail")
  80 
  81         webpack_args.extend(options['extra'])
  82 
  83         static_base = l(settings.STATIC_URL)
  84         suffix = 'js/' if static_base.endswith('/') else '/js/'
  85         os.environ['WEBPACK_PUBLIC_PATH'] = static_base + suffix
  86 
  87         if custom_static_dirs:
  88             # XXX: review this for css
  89             # Append `js/` so that it's not necessary to reference it from the
  90             # `webpack.config.js` file
  91             custom_static_dirs = map(lambda x: os.path.join(x, 'js/'),
  92                                      custom_static_dirs)
  93             os.environ['WEBPACK_ROOT'] = ':'.join(custom_static_dirs)
  94 
  95         try:
  96             subprocess.call(webpack_args)
  97         except OSError:
  98             raise CommandError(
  99                 'webpack executable not found.\n'
  100                 'Make sure to install it by running '
  101                 '`cd %s && npm install`' % default_js_dir
  102             )
  103             sys.exit(0)
  104
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pootle/apps/pootle_app/management/commands/webpack.py b/pootle/apps/pootle_app/management/commands/webpack.py
  --- a/pootle/apps/pootle_app/management/commands/webpack.py
  +++ b/pootle/apps/pootle_app/management/commands/webpack.py
  @@ -19,6 +19,7 @@
   
   class Command(BaseCommand):
       help = 'Builds and bundles static assets using webpack'
  +    requires_system_checks = False
   
       def add_arguments(self, parser):
           parser.add_argument(
  
verification_info: {"golden_diff": "diff --git a/pootle/apps/pootle_app/management/commands/webpack.py b/pootle/apps/pootle_app/management/commands/webpack.py\n--- a/pootle/apps/pootle_app/management/commands/webpack.py\n+++ b/pootle/apps/pootle_app/management/commands/webpack.py\n@@ -19,6 +19,7 @@\n \n class Command(BaseCommand):\n     help = 'Builds and bundles static assets using webpack'\n+    requires_system_checks = False\n \n     def add_arguments(self, parser):\n         parser.add_argument(\n", "issue": "Make `pootle webpack` not require system checks\n`pootle webpack` fails if eg the db is not set up/correctly. It would be helpful if it didnt\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport os\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\nimport subprocess\nimport sys\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom pootle_misc.baseurl import l\n\n\nclass Command(BaseCommand):\n    help = 'Builds and bundles static assets using webpack'\n\n    def add_arguments(self, parser):\n        parser.add_argument(\n            '--dev',\n            action='store_true',\n            dest='dev',\n            default=False,\n            help='Enable development builds and watch for changes.',\n        )\n        parser.add_argument(\n            '--nowatch',\n            action='store_false',\n            dest='watch',\n            default=True,\n            help='Disable watching for changes.',\n        )\n        parser.add_argument(\n            '--progress',\n            action='store_true',\n            default=False,\n            help='Show progress (implied if --dev is present).',\n        )\n        parser.add_argument(\n            '--extra',\n            action='append',\n            default=[],\n            help='Additional options to pass to the JavaScript webpack tool.',\n        )\n\n    def handle(self, **options):\n        default_static_dir = os.path.join(settings.WORKING_DIR, 'static')\n        custom_static_dirs = filter(lambda x: x != default_static_dir,\n                                    settings.STATICFILES_DIRS)\n        default_js_dir = os.path.join(default_static_dir, 'js')\n\n        webpack_config_file = os.path.join(default_js_dir, 'webpack.config.js')\n\n        webpack_bin = os.path.join(default_js_dir, 'node_modules/.bin/webpack')\n        if os.name == 'nt':\n            webpack_bin = '%s.cmd' % webpack_bin\n\n        webpack_progress = (\n            '--progress' if options['progress'] or options['dev'] else ''\n        )\n        webpack_colors = '--colors' if not options['no_color'] else ''\n\n        webpack_args = [webpack_bin, '--config=%s' % webpack_config_file]\n        if webpack_progress:\n            webpack_args.append(webpack_progress)\n        if webpack_colors:\n            webpack_args.append(webpack_colors)\n\n        if options['dev']:\n            watch = '--watch' if options['watch'] else ''\n            webpack_args.extend([watch, '--display-error-details'])\n        else:\n            os.environ['NODE_ENV'] = 'production'\n            webpack_args.append(\"--bail\")\n\n        webpack_args.extend(options['extra'])\n\n        static_base = l(settings.STATIC_URL)\n        suffix = 'js/' if static_base.endswith('/') else '/js/'\n        os.environ['WEBPACK_PUBLIC_PATH'] = static_base + suffix\n\n        if custom_static_dirs:\n            # XXX: review this for css\n            # Append `js/` so that it's not necessary to reference it from the\n            # `webpack.config.js` file\n            custom_static_dirs = map(lambda x: os.path.join(x, 'js/'),\n                                     custom_static_dirs)\n            os.environ['WEBPACK_ROOT'] = ':'.join(custom_static_dirs)\n\n        try:\n            subprocess.call(webpack_args)\n        except OSError:\n            raise CommandError(\n                'webpack executable not found.\\n'\n                'Make sure to install it by running '\n                '`cd %s && npm install`' % default_js_dir\n            )\n            sys.exit(0)\n", "path": "pootle/apps/pootle_app/management/commands/webpack.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport os\nos.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'\nimport subprocess\nimport sys\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom pootle_misc.baseurl import l\n\n\nclass Command(BaseCommand):\n    help = 'Builds and bundles static assets using webpack'\n    requires_system_checks = False\n\n    def add_arguments(self, parser):\n        parser.add_argument(\n            '--dev',\n            action='store_true',\n            dest='dev',\n            default=False,\n            help='Enable development builds and watch for changes.',\n        )\n        parser.add_argument(\n            '--nowatch',\n            action='store_false',\n            dest='watch',\n            default=True,\n            help='Disable watching for changes.',\n        )\n        parser.add_argument(\n            '--progress',\n            action='store_true',\n            default=False,\n            help='Show progress (implied if --dev is present).',\n        )\n        parser.add_argument(\n            '--extra',\n            action='append',\n            default=[],\n            help='Additional options to pass to the JavaScript webpack tool.',\n        )\n\n    def handle(self, **options):\n        default_static_dir = os.path.join(settings.WORKING_DIR, 'static')\n        custom_static_dirs = filter(lambda x: x != default_static_dir,\n                                    settings.STATICFILES_DIRS)\n        default_js_dir = os.path.join(default_static_dir, 'js')\n\n        webpack_config_file = os.path.join(default_js_dir, 'webpack.config.js')\n\n        webpack_bin = os.path.join(default_js_dir, 'node_modules/.bin/webpack')\n        if os.name == 'nt':\n            webpack_bin = '%s.cmd' % webpack_bin\n\n        webpack_progress = (\n            '--progress' if options['progress'] or options['dev'] else ''\n        )\n        webpack_colors = '--colors' if not options['no_color'] else ''\n\n        webpack_args = [webpack_bin, '--config=%s' % webpack_config_file]\n        if webpack_progress:\n            webpack_args.append(webpack_progress)\n        if webpack_colors:\n            webpack_args.append(webpack_colors)\n\n        if options['dev']:\n            watch = '--watch' if options['watch'] else ''\n            webpack_args.extend([watch, '--display-error-details'])\n        else:\n            os.environ['NODE_ENV'] = 'production'\n            webpack_args.append(\"--bail\")\n\n        webpack_args.extend(options['extra'])\n\n        static_base = l(settings.STATIC_URL)\n        suffix = 'js/' if static_base.endswith('/') else '/js/'\n        os.environ['WEBPACK_PUBLIC_PATH'] = static_base + suffix\n\n        if custom_static_dirs:\n            # XXX: review this for css\n            # Append `js/` so that it's not necessary to reference it from the\n            # `webpack.config.js` file\n            custom_static_dirs = map(lambda x: os.path.join(x, 'js/'),\n                                     custom_static_dirs)\n            os.environ['WEBPACK_ROOT'] = ':'.join(custom_static_dirs)\n\n        try:\n            subprocess.call(webpack_args)\n        except OSError:\n            raise CommandError(\n                'webpack executable not found.\\n'\n                'Make sure to install it by running '\n                '`cd %s && npm install`' % default_js_dir\n            )\n            sys.exit(0)\n", "path": "pootle/apps/pootle_app/management/commands/webpack.py"}]}