Runner#

banjo.runner.main()[source]#

The entry point for the Banjo CLI. Declares arguments and then invokes Django management commands. Passing --clean will delete the database and all migrations, which is the simplest way to resolve some complex migration states or other issues when the database content doesn’t matter. If --shell, invokes shell_plus, otherwise invokes runserver, passing along --port and --debug options.

banjo.runner.setup_django(debug=False, settings=None, clean=False)[source]#

Sets up Django and runs prerequisite management commands.

Django needs to be configured before any app-specific code can be loaded. Sets the environment variable DJANGO_SETTINGS_MODULE so Django uses one of Banjo’s settings modules (and so the user’s app doesn’t need a settings file). Then runs django.setup().

Imports the app’s views module, which causes banjo’s route_get and route_post decorators to be invoked, which populates banjo.urls:urlpatterns.

Finally, executes Django management commands makemigrations and migrate, ensuring that the database is in sync with the app’s models.