Bash tab-completion appends trailing slashes to directory names. django-admin startapp name directory/ results in the error:
CommandError: '' is not a valid app directory. Please make sure the directory is a valid identifier.
The error is caused by line 77 of django/core/management/templates.py by calling basename() on the path with no consideration for a trailing slash:
self.validate_name(os.path.basename(target), 'directory')
Removing potential trailing slashes would solve the problem:
self.validate_name(os.path.basename(target.rstrip(os.sep)), 'directory')