[Fixed]-Django-admin command error while project creation

16👍

I think you have 2 versions of django installed, and both are being called when trying to start the project.

Try running pip uninstall django twice, if it runs both time then this was what was going on. Obviously, pip install django afterwards to get it working again

2👍

I had the same problem after using pip to install django 1.10 over an older version.
I used pip to uninstall and manually deleted the leftover django folder in the site-packages folder.
re-installed using pip, and now it is working with no problem.

👤moti

2👍

I am also working with docker containers. I had this problem where it said that manage.py already exists in the workdirectory (that I made through the Dockerfile file) when I tried to restart the process of making a container after deleting the old one.

It did not show me where the workdirectory was made and hence could not delete the manage.py as pointed out in the error.

The solution that worked was I changed the service name in my yml file and gave the command with new servicenm
docker-compose run servicenm django-admin.py startproject projectnm directory

👤Doc

1👍

remove manage.py then re-run your django-admin startproject command, it will work

👤unamed

0👍

Make sure that if you have deleted (rm -r) “your Django project_name” to also delete (rm) the manage.py corresponding deleted project python file in the same repository.

👤Fredus

0👍

sudo pip uninstall django
sudo rm /usr/local/lib/python2.7/dist-packages/django/ -rf
sudo pip install django==1.10

This resolved my problem.

0👍

You need to define another directory for your new project. Not /ehgg directory.
It seems though you are creating a new project inside your old project.
And this error clearly state that, there is old setting i.e “manage.py” for your old project. Since every time a new settings manage.py created for your new project.

I hope it’s clear to you.
Thank you.

0👍

Check whether the project name is correct or not. Django avoids
hypens (-) in project names.

0👍

It can happen due to two reasons:

  1. You are trying to create a new folder with the exiting folder name.
  2. You have previously deleted a folder with this name. Deleted it for some reason. But again trying to create package with this name.

To resolve this follow

  1. Rename the manage.py from your project folder.

  2. Go to <%System Path%>/PycharmProjects/<%Your Project Name%>/.idea/workspace.xml

edit this file “workspace.xml” and then search with the package name you are trying to create.
delete that line and save the file.
Now try to run the command again.

I hope this helps.

Regards,

Leave a comment