Heroku/python failed to detect set buildpack

后端 未结 3 670
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 21:10

I\'m a Django newbie, I created an app and want to deploy it using Heroku. However, when I do git push heroku master (I follow Heroku\'s getting started), this

相关标签:
3条回答
  • 2021-01-01 21:42

    You just have to add requirements.txt to your main application folder.It contain the package that we work on like django ,flask.

    0 讨论(0)
  • 2021-01-01 21:45

    You need to add a requirements.txt file which contains all of the modules required to run your application.

    You can do pip freeze > requirements.txt to freeze all of your modules into a file. I would only recommend doing this if you're using a virtualenv because otherwise it will add ALL of your modules.

    Anyways, just determine exactly what modules your application requires and create a file called requirements.txt and put it in your application directory.

    The syntax for a requirements file is as follows:

    package name == version #
    package name == version #
    package name == version #
    

    Note: It is optional to specify a certain version number.

    Here is an example requirements file (taken from this tutorial):

    Flask==0.11
    Jinja2==2.8
    gunicorn==19.6.0
    

    Don't forget to commit your requirements.txt

    0 讨论(0)
  • 2021-01-01 21:46

    Here are steps by steps you can solve the above problem:

    1. Create a requirements.txt file in your app folder.

    2. Run command pip freeze > requirements.txt from the same folder.

    3. Now commit your changes.

      git add .

      git commit -m "requirements added"

      git push heroku master

    Here's the catch, In my case: I did it without adding any modules because pip can also install a dependency from your local codebase automatically. After running the command when i checked my requirement.txt file there were already modules added automatically.

    NOTE: If this didn't happens to you, you can do it manually like Harrison said in his answer.

    1. This step is only if you get an error similar to my case i got an error about conda== version cant be found. As the modules have been added automatically based on my local codebase, Conda version is installed in my local machine thats why it was automatically added in my requirement.txt file. All you have to do is to remove it from the requirements.txt file.

    2. Commit your changes again.

    Thought it might help some of you who faced similar errors.

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