djangodjango-adminubuntu-15.10

django-admin startproject trying to create manage.py twice?


I'm trying to work through the Django tutorial for version 1.9, running on Ubuntu 15.10. When I get to the step to run django-admin startproject mysite, I get the following error:

/home/.../manage.py already exists, overlaying a project or app 
into an existing directory won't replace conflicting files

A Google search shows I'm not the first one to ask this question, but the answer is always "it looks like you're trying to create a project with the same name. Delete the old project or pick a different name." Unless there's something big I'm missing, that's not my problem. This is the first and only project I'm trying to create. I've tried using different names and creating projects in a number of different directories, and the result is always the same. Each time it fails, I clear out the pwd. Here's what happens:

As far as I can tell, it's trying to create manage.py twice, and the second time it's already there. Below is the content of the manage.py file that's created.

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)

My django-admin version is 1.9.5

Django version is 1.9.5

What's the problem if it's not trying to create two projects with the same name in the same directory?


Solution

  • I think you've got two versions of django installed, and both are being called when starting a project.

    Run 'pip uninstall django' twice, if it runs both times then this could be the case. You can then reinstall the version you want to get it working.