Search code examples
pythonheroku

heroku: no default language could be detected for this app


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

heroku create --buildpack heroku/python

and it displayed

$ heroku create --buildpack heroku/python
Creating app... done, glacial-reef-7599
Setting buildpack to heroku/python... done
https://glacial-reef-7599.herokuapp.com/ | https://git.heroku.com/glacial-reef-7599.git

Stack trace:

$ git push heroku master
Counting objects: 129, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (124/124), done.
Writing objects: 100% (129/129), 69.06 KiB | 0 bytes/s, done.
Total 129 (delta 22), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to pure-badlands-9125.
remote:
To https://git.heroku.com/pure-badlands-9125.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pure-badlands-9125.git'

I've gotta be missing something.

I have added a requirements.txt to my root directory. It looks like this:

.git
.idea
projectapp
projectname
rango
db.sqlite3
manage.py
populate_rango.py
requirements.txt

Solution

  • I can't remember how I fixed this but looking at the Date Modified in my files after I posted this question I created two files:

    runtime.txt (thanks rurp) which contains:

    python-3.5.2
    

    Procfile which contains:

    web: gunicorn projectname.wsgi --log-file -
    

    This is a Django project and projectname.wsgi leads to a wsgi.py located at

    projectname/wsgi.py

    This contains:

    import os
    import signal
    
    import sys
    import traceback
    
    import time
    from django.core.wsgi import get_wsgi_application
    from whitenoise.django import DjangoWhiteNoise
    
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "projectname.settings")
    
    application = get_wsgi_application()
    application = DjangoWhiteNoise(application)