我在项目的外部目录中。当我尝试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
但是当我输入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
两年后,但对于任何从谷歌来到这里的人来说,我只是遇到了同样的问题并解决了它。 当heroku返回“.”作为目录中的唯一文件时,意味着您没有更新git存储库。
希望这有帮助
切换到
myproject
上面的目录并调用heroku run python myproject/manage.py migrate
。您不能在Heroku服务器上的正确目录中。尝试运行
heroku run ls -al
查看当前工作目录中的内容。试着
heroku run pwd
看看你在哪里。您还可以运行
heroku run bash
来获取bash shell。发布前两个命令返回的内容。
相关问题 更多 >
编程相关推荐