ssherwin
ssherwin

Reputation: 541

-bash: ./manage.py: Permission denied

After running: $ ./manage.py migrate I am getting the following error:

-bash: ./manage.py: Permission denied

Trying to run a migration after making a change in the DB. Any advice would be really appreciated.

Upvotes: 53

Views: 83877

Answers (5)

Linda K
Linda K

Reputation: 1

Add this line at the top of your python code;

#!/usr/bin/python3

Then make your file executable by writing chmod +x <file.py> on terminal

then try again

Upvotes: 0

You can try to use

python manage.py migrate

instead of .

/manage.py migrate

Upvotes: 2

I typed su root space after root and it worked.

root was my admin password then the CMD after with a space after the admin password.

Upvotes: -2

Bamara Coulibaly
Bamara Coulibaly

Reputation: 737

To give yourself execute permission for the file containing the script use the command:

chmod u+rwx filename.py

To give other users permission to read and execute but not alter the shell script use:

chmod go+rx filename.py

reference http://unixhelp.ed.ac.uk/scrpt/scrpt1.2.html

Upvotes: 16

Zach Kelling
Zach Kelling

Reputation: 53869

You need to make manage.py executable to excecute it. Do chmod +x manage.py to make it excecutable. Alternately you can do python manage.py <cmd> instead.

Upvotes: 87

Related Questions