Reputation: 1
I can't deploy my Flask app to Heroku... I've searched in every thread I can and nothing worked for me : add a runtime.txt, set a buildpack. I don't know what can be wrong now.
Here is my root directory for the app :
Project
- .git
- Procfile
- Readme.md
- app
- config.py
- requirements.txt
- runtime.txt
- web.py
Here's the content of requirements.txt:
appdirs==1.4.3
click==6.7
Flask==0.12.1
Flask-WTF==0.14.2
itsdangerous==0.24
Jinja2==2.9.5
MarkupSafe==1.0
packaging==16.8
pyparsing==2.2.0
six==1.10.0
Werkzeug==0.12.1
WTForms==2.1
The Procfile :
web: python web.py
And the runtime.txt:
python-2.7.13
When I do git push heroku master
, it prints:
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 appname.
remote:
I tried to add a buildpack with heroku buildpacks:add heroku/Python
but then it says that it can't detect app for python buildpack.
What could I possibly did wrong ?
Upvotes: 0
Views: 4728
Reputation: 23
I'm late the to party but if you already have a requirements.txt file and you're getting this error, try adding a Procfile like shown here in the documentation: https://devcenter.heroku.com/articles/getting-started-with-python#define-a-procfile
Upvotes: 0
Reputation: 148
I also run into similar problem. I was able to fix it by adding the runtime.txt
just put the version of the python you are using in the runtime.txt
python-2.7.14
Upvotes: 0
Reputation: 521
edit the content of your Procfile to
web: gunicorn web:app --log-file=-
I assume your web.py file is contained in your project's root folder i.e you see it once you enter your project's "Project" folder.
Otherwise, if it is contained in the app folder then use
web: gunicorn app.web:app --log-file=-
Upvotes: 0
Reputation: 1835
I was spend time with a very similar error.
In my case, i tried to deploy a django app.
I just run these commands to setup the buildpack
heroku login
heroku create --stack cedar --buildpack git://github.com/heroku/heroku-buildpack-python.git
heroku config:add [email protected]:heroku/heroku-buildpack-python.git#purge
heroku config:set HEROKU=1
I decided to post this here because it took me a long time to get these tips
Upvotes: 0
Reputation: 3493
Change requirements.py
to requirements.txt
.
If you're using the default Python 2.7.13 you shouldn't need a runtime.txt
. You'd think that specifying the runtime would trigger the language detection but even without packages to install, Heroku requires an empty requirements.txt
.
Upvotes: 1