'python: can't open file 'manage.py': [Errno 2] No such file or directory
I have created a Django project "post_blog" in which I have created an app "blogs".
C:Users/arpchauh/PycharmProjects/post_blog/blogs>python manage.py runserver
python: can't open file 'manage.py': [Errno 2] No such file or directory
Solution 1:[1]
manage.py
should live in the root project folder, so if you cd
into C:Users/arpchauh/PycharmProjects/post_blog
, you should be able to run the command.
Solution 2:[2]
Your manage.py
file should be located in the root directory of the project. You need to be in the directory that manage.py
is in.
Solution 3:[3]
The manage.py
file must be available at the root of the project folder. If it is in any sub-directory, it'll give you error.
If you are limited to keeping the file in the sub-directory, you can change the permission of folder, so the python cli can read it.
Solution 4:[4]
One error that might be leading to this is entering
django-admin startapp app_name
instead of
django-admin startproject project_name
Solution 5:[5]
Once you start the django application
django-admin startporject my_project_name
you need to navigate inside the my_project_name folder and then launch
python manage.py runserver
If you are still getting some error, do check where is your python interpreter taking the django setup from
Solution 6:[6]
You're not in the proper directory...In the case you described, you should have:
mkdir newproject (not sure why you're doing this...but we'll continue with it)
cd newproject django-admin.py startproject newproject
cd newproject ? A key missing part from what you did. You need to change into the directory where manage.py resides. Verify it by using ls at the command prompt after switching into the directory.
python manage.py runserver
Use ls often, if you need, to double check where you are in the directory tree.
Solution 7:[7]
Your manage.py file should be located in the root directory of the project. You need to be in the directory that manage.py is in and then run the server python manage.py runserver
Solution 8:[8]
your "manage.py" file is in the "post_blog" folder and you are giving a command in the following directory C:Users/arpchauh/PycharmProjects/post_blog/blogs>
if you focus there is no manage.py file in the blogs folder that why its creating an issue
Use this one, I hope it will resolve your issue
C:Users/arpchauh/PycharmProjects/post_blog> python manage.py runserver
Solution 9:[9]
It's very simple. You are not inside the project root folder (you are in your blog app folder). make sure you change the directory to the project folder and run those commands.
use cd
command to change directory
cd C:Users/arpchauh/PycharmProjects/post_blog
// or move one step backword
cd ..
Solution 10:[10]
Refer to my project path C:\Users\sharpfungs\Desktop\django\djangosite to match with yours. Make sure your virtualenv is active as (myproject) C:> for windows. Then run run the server in the root of project folder.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow