ehmatthes / django-simple-deploy

A reusable Django app that configures your project for deployment
BSD 3-Clause "New" or "Revised" License
304 stars 26 forks source link

Assume settings file matches what's in minimum supported version of Django #303

Closed ehmatthes closed 2 months ago

ehmatthes commented 2 months ago

Occasionally Django changes the imports that are included in the standard settings file generated by startproject, ie when pathlib was added. When it was first added, we couldn't assume everyone had it in their settings file. And for a while people might have generated their settings project a long time ago, and updated the project without updating all the Python conventions in settings being updated. Most of the time this does not cause issues, but sometimes it pops up. See #175.

Assume settings files match conventions used in minimum supported Django. If issues arise, advise users to update their settings file appropriately. If absolutely necessary, consider modifying their settings file, ie adding an import that we're using.

    def _create_log_dir(self):
        """Create a directory to hold log files, if not already present.

        Returns:
            bool: True if created directory, False if already one present.
        """
        self.log_dir_path = settings.BASE_DIR / Path("simple_deploy_logs")
        if not self.log_dir_path.exists():
            self.log_dir_path.mkdir()
            return True
        else:
            return False