Are you getting a “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory” error?
It can happen when you type “python manage.py runserver” into the terminal.
You got the error because you’ve added the manage.py file in a sub-directory.
The file needs to be at the root of the project folder and not a sub-directory.
Otherwise, it’ll give you the “can’t open file” error.
In this guide, you’ll learn how to fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory“.
How to Fix “python: can’t open file ‘manage.py’: [Errno 2] No such file or directory”
To fix the “python: can’t open file” error, you need to go into the folder where manage.py is located.
To do so, you need to type “cd mysite” at the terminal followed by “python manage.py runserver”.
Step 1: Type “cd mysite” into the terminal
cd mysite
Step 2: Run “python manage.py runserver”
python manage.py runserver
Here’s what happens after you run the command:
“Watching for file changes with StatReloader”.
“Performing system checks…”.
“System check identified no issues (0 silenced).
“You have x unapplied migration(s)”.
Starting development server at http://127.0.0.1:8000/.
You’ve successfully fixed the python error!
Further reading
How to Fix “Uncaught SyntaxError: Cannot use import statement outside a module”
How to Fix “A JavaScript error occurred in the main process” on Discord