[英]Django 1.8 python: can't open file 'manage.py': [Errno 2] No such file or directory
I am inside my project's outer directory. 我在项目的外部目录中。 When I try
python manage.py runserver
,it works but if I try to deploy my code and execute heroku run python manage.py migrate
, it shows the following error - 当我尝试
python manage.py runserver
,它可以工作,但如果我尝试部署我的代码并执行heroku run python manage.py migrate
,它会显示以下错误 -
(cenv) C:\Users\Machine\cenv\myproject>heroku run python manage.py migrate
Running `python manage.py migrate` attached to terminal... up, run.6848
python: can't open file 'manage.py': [Errno 2] No such file or directory
but when I input DIR
it shows that manage.py
is in the same directory. 但是当我输入
DIR
它显示manage.py
在同一目录中。
<DIR> .
<DIR> ..
59 .gitignore
<DIR> 2015
<DIR> feature
254 manage.py
<DIR> media
<DIR> myproject
43 Procfile
355 requirements.txt
12 runtime.txt
723 bytes
12,963,143,680 bytes free
(cenv) C:\Users\Machine\cenv\myproject>heroku run ls -al
Running `ls` attached to terminal... failed
! App not found
(cenv) C:\Users\Machine\cenv\myproject>heroku run pwd
Running `pwd` attached to terminal... up, run.3539
/app
You must not be in the right directory on the Heroku server. 您不能位于Heroku服务器上的正确目录中。 Try running
heroku run ls -al
to see what is in the current working directory. 尝试运行
heroku run ls -al
来查看当前工作目录中的内容。
Try heroku run pwd
to see where you are. 试试
heroku run pwd
,看看你在哪里。
You can also run heroku run bash
to get a bash shell to poke around with. 你也可以运行
heroku run bash
来获取一个bash shell。
Post what your first couple of commands return. 发布你的前几个命令返回的内容。
切换到myproject
上面的目录并调用heroku run python myproject/manage.py migrate
。
2 years later but for anyone coming here from google, I just had this same issue and fixed it. 2年后,但对于从谷歌来到这里的任何人,我只是遇到了同样的问题并修复了它。 When heroku return '.'
当heroku返回'。'时 as the only file in the directory it means you have not updated the git repository.
作为目录中的唯一文件,这意味着您还没有更新git存储库。
git push heroku master
hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.