heroku: no default language could be detected for this app

后端 未结 11 753
予麋鹿
予麋鹿 2020-12-03 22:40

First time using Heroku. Trying to push. I have run the command:

heroku create --buildpack heroku/python

and it displayed

$ hero         


        
相关标签:
11条回答
  • 2020-12-03 23:22

    For future references, you must ensure that you are pushing the branch with your code to heroku master.

    If you branched from your master branch and all your code is on a, say, develop, push that to the heroku master.

    So instead of:

    git push heroku master
    

    You would do something like:

    git push heroku develop:master
    

    This question has important details on this How to push different local Git branches to Heroku/master

    0 讨论(0)
  • 2020-12-03 23:22

    You need to create a runtime.txt file. On the command line, in the same folder as your requirements.txt file, enter echo "python-3.5.1" > runtime.txt. Of course, make sure to switch the 3.5.1 with whichever version of Python you are using.

    0 讨论(0)
  • 2020-12-03 23:24

    When deploying using Docker, ensure to set the stack of the app to container, as shown in the docs:

    heroku stack:set container
    
    0 讨论(0)
  • 2020-12-03 23:29

    If you've tried some of the above answers and the problem still persists;

    Ensure you are git "committing" in the right directory.

    For instance, if your file structure is as follow:

    /src
        /...
        manage.py
    .gitignore
    Pipfile/requirements.txt
    Pipfile.lock
    Procfile
    runtime.txt
    

    Ensure you're git adding, committing, pushing etc. from the root directory. Since we work mostly in the src/ or main_app_directory/ we tend to forget to change directory back to root before committing.

    0 讨论(0)
  • 2020-12-03 23:31

    One more thing to note is to actually commit your changes to your git repo, before you can push them to Heroku. You might have a requirements.txt setup locally, but if it's not committed to your repo, git push heroku master will not be able to locate it.

    0 讨论(0)
提交回复
热议问题