Django startproject fails after I manually created the project files/folders (name conflict?)

I’m setting up a Django + Channels project and I think I messed up the order.

I ran these commands:

cd ~
mkdir social_mvp
cd social_mvp

mkdir socialsite
mkdir core
mkdir -p core/templates/core
mkdir -p core/static/core/css

touch manage.py requirements.txt
touch socialsite/__init__.py socialsite/settings.py socialsite/urls.py socialsite/wsgi.py socialsite/asgi.py

python3 -m venv venv
source venv/bin/activate
pip install django channels

django-admin startproject socialsite .

error;

when I run `django-admin startproject socialsite . I get a error;

$ django-admin startproject socialsite .
CommandError: 'socialsite' conflicts with the name of an existing file or directory.

I get a CommandError saying it can’t create the project because something already exists / conflicts (it mentions socialsite and/or manage.py already existing). That makes sense because earlier I manually created manage.py and also created the socialsite/ folder + settings.py, urls.py, etc.

What’s the correct way to do this? Should I not manually create manage.py and the socialsite/ folder first? What’s the right command order for Django + Channels?

$ mkdir socialsite
$ touch manage.py requirements.txt
$ touch \
    socialsite/__init__.py \
    socialsite/settings.py \
    socialsite/urls.py \
    socialsite/wsgi.py \
    socialsite/asgi.py

You don't need to create the hierarchy of socialsite yourself, as django-admin startproject socialsite . should take care of these.

Вернуться на верх