duck.cli.commands.integration

Module containing add-django command class.

Submodules

Package Contents

Classes

DjangoAddCommand

Functions

copy_template_settings_and_urls

Copies template settings and URLs files to the given destination paths.

ignore_pycache

Ignore pycache directories during copy.

move_settings_py

Move settings.py to ‘old’ directory but make some modifications to the destination file.

Data

ASGI_PY_CONTENT

EXECUTION_CONFIG_CONTENT

MANAGE_PY_CONTENT

WSGI_PY_CONTENT

API

duck.cli.commands.integration.ASGI_PY_CONTENT

‘lstrip(…)’

class duck.cli.commands.integration.DjangoAddCommand[source]
classmethod integrate_django(django_project_path: str, django_project_mainapp_name: str = None, destination_name: str = 'duckapp')[source]

Integrates an existing Django project into a Duck project.

This method prepares a Django project to work within the Duck framework by extracting the main application, copying configuration files, and adapting the project structure.

Parameters:
  • django_project_path – Absolute path to the root directory of the existing Django project.

  • django_project_mainapp_name – Name of the main application within the Django project. If None, the name will be inferred from the Django project directory.

  • destination_name – Name of the destination Duck project. If None, it defaults to the name of the Django project directory. Defaults to “duckapp”

Raises:
  • FileNotFoundError – If the provided Django project path or main app directory does not exist.

  • ValueError – If required files like settings.py or urls.py are missing or malformed.

classmethod main(django_project_path: str, django_project_mainapp_name: str = None, destination_name: str = 'duckapp')[source]

Integrates an existing Django project into a Duck project.

This method prepares a Django project to work within the Duck framework by extracting the main application, copying configuration files, and adapting the project structure.

Parameters:
  • django_project_path – Absolute path to the root directory of the existing Django project.

  • django_project_mainapp_name – Name of the main application within the Django project. If None, the name will be inferred from the Django project directory.

  • destination_name – Name of the destination Duck project. If None, it defaults to the name of the Django project directory. Defaults to “duckapp”

Raises:
  • FileNotFoundError – If the provided Django project path or main app directory does not exist.

  • ValueError – If required files like settings.py or urls.py are missing or malformed.

classmethod setup()[source]
duck.cli.commands.integration.EXECUTION_CONFIG_CONTENT

‘lstrip(…)’

duck.cli.commands.integration.MANAGE_PY_CONTENT

‘lstrip(…)’

duck.cli.commands.integration.WSGI_PY_CONTENT

‘lstrip(…)’

duck.cli.commands.integration.copy_template_settings_and_urls(settings_py: str, urls_py: str) None[source]

Copies template settings and URLs files to the given destination paths.

Parameters:
  • settings_py – Destination path for the new settings.py file.

  • urls_py – Destination path for the new urls.py file.

duck.cli.commands.integration.ignore_pycache(dir_path, contents)[source]

Ignore pycache directories during copy.

duck.cli.commands.integration.move_settings_py(src, dest)[source]

Move settings.py to ‘old’ directory but make some modifications to the destination file.