This code is copied verbatim from Django's
        TemplateCommand.handle(), but with the directory creation
        code removed.

def get_project_directory(self, name, target):
        """
        This code is copied verbatim from Django's
        TemplateCommand.handle(), but with the directory creation
        code removed.
        """
        # if some directory is given, make sure it's nicely expanded.
        if target is None:
            top_dir = os.path.join(os.getcwd(), name)
        else:
            top_dir = os.path.abspath(os.path.expanduser(target))
            if not os.path.exists(top_dir):
                raise CommandError("Destination directory '%s' does not "
                                   "exist, please create it first." % top_dir)

        return top_dir