community / community.general / 6.6.8 / module / django_manage Manages a Django application Authors: Alexei Znamensky (@russoz), Scott Anderson (@tastychutney)community.general.django_manage (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Manages a Django application using the C(manage.py) application frontend to C(django-admin). With the I(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. The commands listed below are built in this module and have some basic parameter validation. - 'C(cleanup) - clean up old data from the database (deprecated in Django 1.5). This parameter will be removed in community.general 9.0.0. Use C(clearsessions) instead. ' - C(collectstatic) - Collects the static files into C(STATIC_ROOT). - C(createcachetable) - Creates the cache tables for use with the database cache backend. - C(flush) - Removes all data from the database. - C(loaddata) - Searches for and loads the contents of the named I(fixtures) into the database. - C(migrate) - Synchronizes the database state with models and migrations. - 'C(syncdb) - Synchronizes the database state with models and migrations (deprecated in Django 1.7). This parameter will be removed in community.general 9.0.0. Use C(migrate) instead. ' - C(test) - Runs tests for all installed apps. - 'C(validate) - Validates all installed models (deprecated in Django 1.7). This parameter will be removed in community.general 9.0.0. Use C(check) instead. ' - Other commands can be entered, but will fail if they are unknown to Django. Other commands that may prompt for user input should be run with the C(--noinput) flag. 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. - This would be equivalent to adding I(pythonpath)'s value to the C(PYTHONPATH) environment variable. required: false type: path testrunner: aliases: - test_runner description: - 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 C(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 C(manage.py) lives. required: true type: path ack_venv_creation_deprecation: description: - When a I(virtualenv) is set but the virtual environment does not exist, the current behavior is to create a new virtual environment. That behavior is deprecated and if that case happens it will generate a deprecation warning. Set this flag to C(true) to suppress the deprecation warning. - Please note that you will receive no further warning about this being removed until the module will start failing in such cases from community.general 9.0.0 on. type: bool version_added: 5.8.0 version_added_collection: community.general