def METHOD_NAME(self):
    logger.info(
        "Deploying to PythonAnywhere {instance} for: {app_name}".format(
            instance=self.instance, app_name=self.app_name
        )
    )
    headers = {"Authorization": "Token {token}".format(token=self.token)}
    domain = "{username}.pythonanywhere.com".format(username=self.username)
    if self.instance == "eu":
        domain = "{username}.eu.pythonanywhere.com".format(
            username=self.username
        )
    # Progress steps are calculated as the number of files to upload plus
    # the five-ish additional API calls needed to configure and restart
    # the web application.
    self.progress.setMaximum(len(self.files) + 5)
    # The counter tracks how much progress has been made.
    counter = 1
    try:
        # Get web application details (if required).
        self.progress.setValue(counter)
        path = self.url + "webapps/"
        response = requests.get(path, headers=headers)
        response.raise_for_status()
        apps = response.json()
        # Create the application if it doesn't exist.
        exists = False
        for app in apps:
            if app["domain_name"] == domain:
                exists = True
                break
        if not exists:
            # Create the app.
            response = requests.post(
                path,
                data={
                    "domain_name": domain,
                    "python_version": "python38",
                },
                headers=headers,
            )
            response.raise_for_status()
            # Configure serving of static files.
            path = self.url + "webapps/{domain}/static_files/".format(
                domain=domain
            )
            response = requests.post(
                path,
                data={
                    "url": "/static/",
                    "path": self.static_path,
                },
                headers=headers,
            )
            response.raise_for_status()
        counter += 1
        # Upload files.
        for target, source in self.files.items():
            self.progress.setValue(counter)
            with open(source, "rb") as source_file:
                path = self.url + self.files_path + target
                response = requests.post(
                    path,
                    files={"content": source_file.read()},
                    headers=headers,
                )
                response.raise_for_status()
            counter += 1
        # Update WSGI settings.
        self.progress.setValue(counter)
        logger.info(self.wsgi_config)
        path = self.url + self.wsgi_path
        response = requests.post(
            path,
            files={"content": self.wsgi_config},
            headers=headers,
        )
        response.raise_for_status()
        counter += 1
        # Force HTTPS and source directory.
        self.progress.setValue(counter)
        data = {
            "source_directory": "/home/{username}/{app_name}/".format(
                username=self.username, app_name=self.app_name
            ),
            "force_https": True,
        }
        path = self.url + "webapps/{domain}/".format(domain=domain)
        response = requests.put(path, data=data, headers=headers)
        response.raise_for_status()
        counter += 1
        # Reload the application.
        self.progress.setValue(counter)
        path = self.url + "webapps/{domain}/reload/".format(domain=domain)
        response = requests.post(path, headers=headers)
        response.raise_for_status()
        counter += 1
        self.progress.setValue(counter)
        self.finished.emit(domain)
    except Exception as ex:
        # Gracefully report all failures (logged and reported upstream).
        self.error.emit(repr(ex))