Fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”

Must Read
Smriti Razdan
Smriti Razdan
Smriti started her journey by attaining a degree in computer applications. She loves to indulge in reading undiscovered stories only to draw profound explanations about life and its existence. She welcomes you aboard on her expedition of finding herself. Smriti writes her content with a smile on her face hoping to transcend it to her readers.

Among many errors encountered in Python, “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory” is a very common one. If you are getting this error, you are not alone. And fixing this only takes a couple of steps of work.

What happened is that you have added the manage.py file in a sub-directory when it needs to be at the root of the project. That’s why when you type “python manage.py runserver” into the terminal, Python gives you a “can’t open file” error.

The fix is very simple. All you need to do is follow the two steps and get rid of the “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory” error. Let’s do this, shall we?

How to Fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”

Fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”

Follow these steps to fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory” error:

1. Type “cd mysite” into the terminal

“python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”

2. Then run “python manage.py runserver”

“python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”

After you run the commands, a series of dialogues follow:

“Watching for file changes with StatReloader”.

“Performing system checks…”.

“System check identified no issues (0 silenced).

“You have x unapplied migration(s)”.

And then this happens:

Starting development server at http://127.0.0.1:8000/.

Voila! You have successfully fixed “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory” error.

Also, read What is 403 Forbidden Error and How to Fix 403 Forbidden Error?

Wrapping Up

This is a guaranteed fix to the Python error. You just need to be in a directory where “manage.py” is located. These are tiny mistakes that coders of all levels tend to make. Yet, at the time of making such a mistake, you don’t really realize what happened, and it can be frustrating. I am sure this helped. Happy coding!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

More Articles Like This