Uploaded image for project: 'AcousticBrainz'
  1. AcousticBrainz
  2. AB-317

Use flask CLI for management commands and tools

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      With the switch to MetaBrainz' CustomFlask we now load various configuration files when we create an app. As a result of this, we no longer want to import specific config files directly in separate util commands.

      Additionally, having all connections to external services in a single place (create_app) makes it easier to make changes to the way that we configure these services.

      Recent versions of flask have a CLI interface: http://flask.pocoo.org/docs/0.12/cli/

      Using this will allow us to automatically start up a flask context, complete with configuration settings and connections to external services (database, etc) allowing us to use them for both existing management commands, and long running processes (such as the hl calculator or dataset evaluator).

      By running commands from a single entry point we no longer have to modify sys.path, or remember to run python -m from the correct directory to run a command.

      The flask CLI is based on Click, which we already use in manage.py for AB. Altering this to use the flask CLI shouldn't be a large job.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              iliekcomputers Param Singh
              Reporter:
              alastairp Alastair Porter
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package