community / community.general / 3.8.10 / module / django_manage Manages a Django application. Authors: Scott Anderson (@tastychutney)community.general.django_manage (3.8.10) — module
Install with ansible-galaxy collection install community.general:==3.8.10
collections: - name: community.general version: 3.8.10
Manages a Django application using the C(manage.py) application frontend to C(django-admin). With the C(virtualenv) parameter, all management commands will be executed by the given C(virtualenv) installation.
- name: Run cleanup on the application installed in django_dir community.general.django_manage: command: cleanup project_path: "{{ django_dir }}"
- name: Load the initial_data fixture into the application community.general.django_manage: command: loaddata project_path: "{{ django_dir }}" fixtures: "{{ initial_data }}"
- name: Run syncdb on the application community.general.django_manage: command: syncdb project_path: "{{ django_dir }}" settings: "{{ settings_app_name }}" pythonpath: "{{ settings_dir }}" virtualenv: "{{ virtualenv_dir }}"
- name: Run the SmokeTest test case from the main app. Useful for testing deploys community.general.django_manage: command: test project_path: "{{ django_dir }}" apps: main.SmokeTest
- name: Create an initial superuser community.general.django_manage: command: "createsuperuser --noinput --username=admin --email=admin@example.com" project_path: "{{ django_dir }}"
apps: description: - A list of space-delimited apps to target. Used by the C(test) command. required: false type: str link: description: - Will create links to the files instead of copying them, you can only use this parameter with C(collectstatic) command. required: false type: bool skip: description: - Will skip over out-of-order missing migrations, you can only use this parameter with C(migrate) command. required: false type: bool clear: default: false description: - Clear the existing files before trying to copy or link the original file. - Used only with the C(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 C(migrate) command. required: false type: bool command: description: - The name of the Django management command to run. Built in commands are C(cleanup), C(collectstatic), C(flush), C(loaddata), C(migrate), C(syncdb), C(test), and C(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 C(--noinput) flag. - The module will perform some basic parameter validation (when applicable) to the commands C(cleanup), C(collectstatic), C(createcachetable), C(flush), C(loaddata), C(migrate), C(syncdb), C(test), and C(validate). required: true type: str database: description: - The database to target. Used by the C(createcachetable), C(flush), C(loaddata), C(syncdb), and C(migrate) commands. required: false type: str failfast: aliases: - fail_fast default: false description: - Fail the command immediately if a test fails. Used by the C(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 C(loaddata) command. required: false type: str settings: description: - The Python path to the application's settings module, such as C(myapp.settings). required: false type: path pythonpath: aliases: - python_path 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 type: path testrunner: aliases: - test_runner description: - 'From the Django docs: Controls the test runner class that is used to execute tests.' - This parameter is passed as-is to C(manage.py). required: false type: str virtualenv: aliases: - virtual_env description: - An optional path to a I(virtualenv) installation to use while running the manage application. type: path cache_table: description: - The name of the table used for database-backed caching. Used by the C(createcachetable) command. required: false type: str project_path: aliases: - app_path - chdir description: - The path to the root of the Django application where B(manage.py) lives. required: true type: path