2

Why is it that I have to run python manage.py somecommand and others simply run manage.py somecommand? I'm on OSX 10.6. Is this because there is a pre-set way to enable .py files to automatically run as Python scripts, and I've somehow disabled the functionality, or is that something that you explicitly enable?

asked Aug 24, 2011 at 20:56

3 Answers 3

6

If you are using a recent version of Django, the manage.py file should be an "executable" file by default.

Please note, you cannot just type manage.py somecommand into the terminal as manage.py is not on the PATH, you will have to type ./ before it to run it from the current directory, i.e. ./manage.py somecommand.

If that does not work please be sure that the manage.py file has: #!/usr/bin/env python as its first line. And make sure it is executable: chmod +x manage.py

answered Aug 24, 2011 at 21:02
Sign up to request clarification or add additional context in comments.

1 Comment

Just to clarify, when you install Django via pip and do "django-admin.py startproject pancakes" the ‘manage.py’ in the ‘pancakes/’ directory won't be executable. This is a bug with pip, not Django.
1

There are two things you should look at:

First, is the manage.py script set to be executable? If not, try

chmod u+x manage.py

Secondly, does manage.py have a valid hashbang line? If not, you could try adding one that points to the correct python interpreter for your system.

answered Aug 24, 2011 at 21:00

Comments

1

On the mac the manage.py command has to be executable to just run it without the python command. You can do this with:

chmod 755 manage.py

If you are in the same directory as manage.py, to run it you type:

./manage.py somecommand

Otherwise you want to specify the path:

/path/to/my/project/manage.py somecommand
answered Aug 24, 2011 at 21:01

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.