django_ftpserver.server

FTP Server runner module.

This module provides classes for configuring and running an FTP server independently of Django management commands.

class django_ftpserver.server.FTPServerConfig(host: str, port: int, timeout: int | None = None, passive_ports: List[int] | None = None, masquerade_address: str | None = None, file_access_user: str | None = None, certfile: str | None = None, keyfile: str | None = None, sendfile: bool | None = None, server_class: str | Type | None = None, handler_class: str | Type | None = None, authorizer_class: str | Type | None = None, filesystem_class: str | Type | None = None, handler_options: dict = <factory>)

Configuration for FTP server.

This class holds all configuration needed to create and run an FTP server. All options except host and port are optional.

class django_ftpserver.server.FTPServerRunner(config: FTPServerConfig)

FTP server runner.

This class handles creation and execution of an FTP server. Daemon mode and PID file management are NOT handled here; they should be managed by the caller (e.g., management command).

create_server() FTPServer

Create and return an FTP server instance.

Returns:

FTPServer instance ready to serve

run(sender=None) None

Run the FTP server.

This method starts the server and blocks until the server is stopped. Signals are sent at server start and stop.

Parameters:

sender – The sender for signals (e.g., Command class). If None, uses FTPServerRunner class.

property server: FTPServer | None

Return the current server instance.