Deepak Gupta
Deepak Gupta

Reputation: 259

django-admin command error while project creation

After upgrading to django 1.9 and tried creating new project.Getting following error How should i solve this?

After upgrading to django 1.9 and creating new project following error occurred CommandError: /home/shaastr/ehgg/manage.py already exists, overlaying a project or app into an existing directory won't replace conflicting files

Upvotes: 17

Views: 10320

Answers (9)

Vinit Kumar
Vinit Kumar

Reputation: 1

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,

Upvotes: 0

Chandan Sharma
Chandan Sharma

Reputation: 2519

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

Upvotes: 0

Doc
Doc

Reputation: 21

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

Upvotes: 2

Bipul Kumar
Bipul Kumar

Reputation: 1

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.

Upvotes: 0

hotbaby
hotbaby

Reputation: 1

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.

Upvotes: 0

moti
moti

Reputation: 21

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.

Upvotes: 2

unamed
unamed

Reputation: 19

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

Upvotes: 1

Fredus
Fredus

Reputation: 1

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.

Upvotes: 0

user3081159
user3081159

Reputation: 186

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

Upvotes: 16

Related Questions