Django has become my favorite web development framework. It’s Python-based and in a couple of minutes you can deploy your first app. A problem I ran into when building my first apps was that I seemingly had to create a subfolder to start a new project.
To create a new project, one typically uses the following command.
django-admin startproject <YOUR_PROJECT_NAME>
This command creates a new project within the existing folder. However, if you’re working within a git repository, you might not want to have your project skeleton in a subfolder. And if you thought you could just run the command one level higher, you’re in for a bad surprise. The following error will be shown:
CommandError: 'path/to/YOUR_PROJECT_NAME' already exists
Although it’s not documented in the official documentation, the solution, however, is extremely simple. You just add a dot to Django’s startproject command, which uses the command’s [directory] argument.
django-admin startproject <YOUR_PROJECT_NAME> .
Now go on, go work on your new project!