Forums

python: can't open file 'manage.py': [Errno 2] No such file or directory

i was just following tutorial (http://tutorial.pythonanywhere.com/django) and then i got this error: python: can't open file 'manage.py': [Errno 2] No such file or directory i sure have manage.py in its default folder, i didnt change anything with it, but it's not working =( sorry for the dumb question, im a newbie here...

That can happen because manage.py does not have execute permissions. You can fix this with chmod +x manage.py.

thank u for help, i tried that, but still not working( 10:50 ~ $ python ./manage.py syncdb
python: can't open file './manage.py': [Errno 2] No such file or directory

12:03 ~ $ chmod +x manage.py chmod: cannot access ‘manage.py’: No such file or directory

but i definetely have that file, here's a screenshot: http://postimg.org/image/9gkaw9ob5/

my friend helped me... the answer is, if anyone will ever need it, is u gotta use this command:

python ./mysite/manage.py syncdb

Yes, it's because the file was located in a subdirectory. You need to either enter the appropriate subdirectory (with cd) or add it to the filename as you've done in your example. If you need to brush up on this sort of thing, there are any number of introductory pages out there like this one or this one.

thank you.

to me its still giving me the error

Are you in the directory where your manage.py file is?

that's right. just use cd mysite and go to the same directory as your manage.py.

that's right. just use cd mysite and go to the same directory as your manage.py.

I wrote cd mysite but I still got an error "bash: cd: mysite: Not such of file or directory"

Do you have a mysite directory to cd into? Is your site in a differently named directory?

yes

19:31 ~/feedcoder.pythonanywhere.com (master)$ cd /manage.py
bash: cd: /manage.py: No such file or directory

19:32 ~/feedcoder.pythonanywhere.com (master)$ python manage.py createsuperuser
File "manage.py", line 16 ) from exc ^ SyntaxError: invalid syntax

The error in your first post is because you're trying to cd into something that doesn't exist. If you want to reference a file in the current directory, you should just use something like "manage.py". The syntax "/manage.py" means "go up to the very top of the directory tree, then find the file or directory there called "manage.py". Additionally, "cd" is how you navigate into directories, and "manage.py" is a file, not a directory.

The second error is because you're using the wrong version of Python to try to run the code. It looks like your website is set up to use Python 3.5, so the command to run manage.py would be this:

python3.5 manage.py createsuperuser