简体   繁体   中英

django-admin startproject does not create manage.py

I am trying to create a new Django 1.5 project. I just installed Python 2.7.15, created a virtualenv, and installed Django 1.5. I don't have any other version installed.

When I run python django-admin.py startproject myproject it creates a new folder:

  • myproject/
    • myproject/
      • __init__.py
      • ...

But manage.py is missing in the top folder. What am I doing wrong?

Disclaimer

I still strongly urge you to upgrade whatever you need to upgrade so you can get off of Django 1.5 and onto a supported version, ideally the latest release.

Solution

I was able to reproduce your problem with Django==1.5 . For some reason the lib/python2.7/site-packages/django/conf/project_template/ directory lacks a manage.py file.

While I haven't found the bug report, the latest bugfix release in the Django 1.5 lineage, version 1.5.12 (January, 2015), includes manage.py as expected. If you must use a 1.5.x version, please use this latest one. It should be compatible.

If you absolutely must use an older version of Django 1.5 that lacks its own manage.py you can create the file yourself. Here are its entire contents from my Django 1.5.12 test install:

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

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

You'll have to replace {{ project_name }} with your actual project name.

you may also have django installed twice. I had the same behavior and found that I had installed django twice by following the answer from the below thread:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM