简体   繁体   English

Django 1.8 python:无法打开文件'manage.py':[Errno 2]没有这样的文件或目录

[英]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.

相关问题 无法打开文件'.manage.py':[Errno 2] 没有这样的文件或目录 - can't open file '.manage.py': [Errno 2] No such file or directory 无法打开文件 &#39;manage.py&#39;: [Errno 2] 没有那个文件或目录 - Can't open file 'manage.py': [Errno 2] No such file or directory 内部 Docker 容器 - python:无法打开文件 './services/web/manage.py':[Errno 2] 没有这样的文件或目录 - Inside Docker Container - python: can't open file './services/web/manage.py': [Errno 2] No such file or directory python:无法打开文件“manage.py”:[Errno 2] 没有这样的文件或目录 docker-compose run - python: can't open file 'manage.py': [Errno 2] No such file or directory docker-compose run python:无法打开文件“.manage.py”:[Errno 2] 没有这样的文件或目录 - python: can't open file '.manage.py': [Errno 2] No such file or directory Docker compose - python:无法打开文件“manage.py”:[Errno 2] 没有这样的文件或目录 - Docker compose - python: can't open file 'manage.py': [Errno 2] No such file or directory docker-web-1 | python:无法打开文件&#39;/code/manage.py&#39;:[Errno 2] 没有那个文件或目录 - docker-web-1 | python: can't open file '/code/manage.py': [Errno 2] No such file or directory python: 无法打开文件 'manage.py': [Errno 2] 编写时没有这样的文件或目录 docker - python: can't open file 'manage.py': [Errno 2] No such file or directory when compose docker windows 10 专业版中的 Docker:python:无法打开文件“manage.py”:[Errno 2] 没有这样的文件或目录 - Docker in windows 10 pro: python: can't open file 'manage.py': [Errno 2] No such file or directory Docker for windows10 运行 django 失败:无法打开文件“manage.py”:[Errno 2] 没有那个文件或目录 - Docker for windows10 run django fail: Can't open file 'manage.py': [Errno 2] No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM