Runner#
- banjo.runner.main()[source]#
The entry point for the Banjo CLI. Declares arguments and then invokes Django management commands. Passing
--cleanwill 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, invokesshell_plus, otherwise invokesrunserver, passing along--portand--debugoptions.
- 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_MODULEso Django uses one of Banjo’s settings modules (and so the user’s app doesn’t need a settings file). Then runsdjango.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
makemigrationsandmigrate, ensuring that the database is in sync with the app’s models.