########################### Django App Helper reference ########################### ********************************* Commands ********************************* Commands take the general form:: django-app-helper [options ...] where **** is the Django application name and **** is a Django supported command, *or* one of the django-app-helper commands detailed below. Options vary for each command. .. note:: while all examples here use the ``django-app-helper`` CLI, a more idiomatic way to run commands is by using :ref:`runner`. Common options ============== * ``--extra-settings=path``: loads the extra settings from the provided file instead of the default ``helper.py`` * ``cms``: loads django CMS specific options (see :ref:`cms-option` for details) Django commands =============== Django App Helper supports any Django command available according to the project setup; the general syntax is:: django-app-helper [options] [--extra-settings=] [--cms] Example: ``django-app-helper some_application shell --cms`` Arguments --------- * ```` is any available Django command * ``[options]`` is any option/argument accepted by the above command test ==== :: django-app-helper test [--failfast] [--migrate] [...] [--xvfb] [--runner=] [--extra-settings=] [--cms] [--simple-runner] [--runner-options=,] Example: ``django-app-helper some_application test --cms`` Runs the application's test suite in Django App Helper's virtual environment. Arguments --------- * ````: a space-separated list of tests to run; test labels depends on the runner test suite building protocol, please, refer to the runner documentation to know the test label format; Options ------- * ``--runner``: custom test runner to use in dotted path notation; * ``--runner-options=,``: comma separated list of command line options for the test runner: e.g. ``--runner-options="--with-coverage,--cover-package=my_package"`` * ``--failfast``: whether to stop at first test failure; * ``--migrate``: use migrations (default); * ``--persistent``: use persistent storage for media and static; by default storage is created in ``data`` directory in the root of the application; if a different directory is needed, use ``--persistent-path`` to provide the path; * ``--persistent-path``: persistent storage path, instead of ``data`` * ``--no-migrate``: skip migrations; * ``--xvfb``: whether to configure ``xvfb`` (for frontend tests); * ``--native`` use the native Django command: the use of this option is **incompatible** with the options above. Test structure -------------- Currently two different tests layouts are supported: * tests outside the application module:: setup.py tests __init__.py test_module1.py .... * tests inside the application:: setup.py application tests __init__.py test_module1.py ... Depending on the used test runner you may need to setup your tests accordingly. The default runner is the Django one, but it's possible to specify your own custom runner with the ``--runner`` option. cms_check ========= :: django-app-helper cms_check [--extra-settings=] [--migrate] Runs the django CMS ``cms check`` command. Example: ``django-app-helper some_application cms_check`` update and compile locales ========================== :: django-app-helper makemessages [--extra-settings=] [--cms] [--locale=locale] django-app-helper compilemessages [--extra-settings=] [--cms] Examples:: django-app-helper some_application makemessages --cms django-app-helper some_application compilemessages --cms These two commands compiles and update the locale messages. Options ------- * ``--locale=locale``: ``makemessages`` allows a single option to choose the locale to update. If not provided **en** is used. makemigrations ============== :: django-app-helper makemigrations [--extra-settings=] [--cms] [--merge] [--dry-run] [--empty] [...] Updates the application migrations (south migrations or Django migrations according to the current installed Django version). For South, it automatically handles ``initial`` and ``auto`` options. Options ------- * ``--merge``: Enable fixing of migration conflicts * ``--empty``: It generates an empty migration for customisations * ``--dry-run``: Does not create migrations file Arguments --------- * ````: Spaces separated list of applications to migrate squashmigrations ================ :: django-app-helper squashmigrations Runs the ``squashmigrations`` command. It operates on the current application. Arguments --------- * ````: Squash migrations until this migration authors ======= :: django-app-helper authors [--extra-settings=] [--cms] Generates an authors list from the git log, in a form suitable for the **AUTHORS** file. server ====== :: django-app-helper server [--port=] [--bind=] [--extra-settings=] [--cms] [--migrate] [--no-migrate] [--persistent | --persistent-path=] [--verbose=] [--use-daphne] [--use-channels] Starts a runserver instance. * ``--port=``: port to bind the server on; * ``--bind=``: address to bind the server on; * ``--extra-settings=``: path to extra settings file; * ``--cms``: enable django CMS settings; * ``--migrate``: run migrations on server start (default); * ``--no-migrate``: do not run migrations on server start; * ``--persistent | --persistent-path=``: persist generated media directory; optionally you can provide a fixed path; * ``--verbose=``: verbosity level; * ``--use-daphne``: use daphne server; * ``--use-channels]``: use channels server;