安装Django后无法打开manage.py [英] cannot open manage.py after installing django

查看:491
本文介绍了安装Django后无法打开manage.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置Django时遇到问题.

I have a problem in setting up django.

我的情况:我的Windows 8计算机中装有Anaconda Python 2.7.在Anaconda命令提示符窗口中,键入:pip install 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.

然后我创建一个名为"newproject"的文件夹.在命令提示符下,我转到文件夹"newproject".然后django-admin.py startproject newproject.成功了.

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.

然后我运行python manage.py runserver.它告诉我

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

我在网上检查了udemy django安装指南和其他指南.我什至设置了一个虚拟环境.但是主要的问题始终是:can't open file 'manage.py'

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'

推荐答案

您不在正确的目录中...在您描述的情况下,您应该具有:

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

  1. mkdir newproject(不确定为什么要这样做...但我们将继续进行下去)
  2. cd newproject
  3. django-admin.py startproject newproject
  4. cd newproject←您所做的工作中缺少关键的一环.您需要切换到 manage.py 所在的目录.切换到目录后,在命令提示符下使用ls进行验证.
  5. python manage.py runserver
  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

如果需要,经常使用ls仔细检查您在目录树中的位置.

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

这篇关于安装Django后无法打开manage.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆