Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot open manage.py after installing django

I have a problem in setting up django.

My situation: I have Anaconda Python 2.7 in my Windows 8 computer. On the Anaconda command prompt window, I type: pip install django. This is successful.

Then I create a folder named "newproject". On the command prompt I went to the folder "newproject". Then django-admin.py startproject newproject. This is successful.

Then I run python manage.py runserver. It tells me

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

I checked out udemy django installation guide and other guides on the net. I have even set up a virtual environment. But the main problem is always: can't open file 'manage.py'

like image 514
Mel Avatar asked Mar 21 '16 13:03

Mel


People also ask

How do I open manage py?

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.

Can't open manage py 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”.

Why does Python manage py Runserver not work?

The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.


2 Answers

You're not in the proper directory...In the case you described, you should have:

  1. mkdir newproject (not sure why you're doing this...but we'll continue with it)
  2. cd newproject
  3. django-admin.py startproject newproject
  4. 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.
  5. python manage.py runserver

Use ls often, if you need, to double check where you are in the directory tree.

like image 188
rnevius Avatar answered Nov 05 '22 18:11

rnevius


You are not in the correct directory. You need to do cd newproject and the execute your runserver command.

like image 26
Aditya Singh Chauhan Avatar answered Nov 05 '22 17:11

Aditya Singh Chauhan