ansible / ansible.builtin / v2.9.27 / module / django_manage Manages a Django application. | "added in version" 1.1 of ansible.builtin" Authors: Scott Anderson (@tastychutney) preview | supported by communityansible.builtin.django_manage (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Manages a Django application using the I(manage.py) application frontend to I(django-admin). With the I(virtualenv) parameter, all management commands will be executed by the given I(virtualenv) installation.
# Run cleanup on the application installed in 'django_dir'. - django_manage: command: cleanup app_path: "{{ django_dir }}"
# Load the initial_data fixture into the application - django_manage: command: loaddata app_path: "{{ django_dir }}" fixtures: "{{ initial_data }}"
# Run syncdb on the application - django_manage: command: syncdb app_path: "{{ django_dir }}" settings: "{{ settings_app_name }}" pythonpath: "{{ settings_dir }}" virtualenv: "{{ virtualenv_dir }}"
# Run the SmokeTest test case from the main app. Useful for testing deploys. - django_manage: command: test app_path: "{{ django_dir }}" apps: main.SmokeTest
# Create an initial superuser. - django_manage: command: "createsuperuser --noinput --username=admin --email=admin@example.com" app_path: "{{ django_dir }}"
apps: description: - A list of space-delimited apps to target. Used by the 'test' command. required: false link: description: - Will create links to the files instead of copying them, you can only use this parameter with 'collectstatic' command required: false type: bool version_added: '1.3' version_added_collection: ansible.builtin skip: description: - Will skip over out-of-order missing migrations, you can only use this parameter with I(migrate) required: false type: bool version_added: '1.3' version_added_collection: ansible.builtin clear: default: false description: - Clear the existing files before trying to copy or link the original file. - Used only with the 'collectstatic' command. The C(--noinput) argument will be added automatically. required: false type: bool merge: description: - Will run out-of-order or missing migrations as they are not rollback migrations, you can only use this parameter with 'migrate' command required: false type: bool version_added: '1.3' version_added_collection: ansible.builtin command: choices: - cleanup - collectstatic - flush - loaddata - migrate - runfcgi - syncdb - test - validate description: - The name of the Django management command to run. Built in commands are cleanup, collectstatic, flush, loaddata, migrate, runfcgi, syncdb, test, and validate. - Other commands can be entered, but will fail if they're unknown to Django. Other commands that may prompt for user input should be run with the I(--noinput) flag. required: true app_path: description: - The path to the root of the Django application where B(manage.py) lives. required: true database: description: - The database to target. Used by the 'createcachetable', 'flush', 'loaddata', and 'syncdb' commands. required: false failfast: default: 'no' description: - Fail the command immediately if a test fails. Used by the 'test' command. required: false type: bool fixtures: description: - A space-delimited list of fixture file names to load in the database. B(Required) by the 'loaddata' command. required: false settings: description: - The Python path to the application's settings module, such as 'myapp.settings'. required: false pythonpath: description: - A directory to add to the Python path. Typically used to include the settings module if it is located external to the application directory. required: false virtualenv: aliases: - virtualenv description: - An optional path to a I(virtualenv) installation to use while running the manage application. cache_table: description: - The name of the table used for database-backed caching. Used by the 'createcachetable' command. required: false