I'm getting a rejected error when trying to deploy a Flask app to Heroku.
This is the build log: https://i.stack.imgur.com/FnVwp.png
My requirements.txt: https://i.stack.imgur.com/8CgsE.png
Procfile: https://i.stack.imgur.com/gDQIv.png
Can someone provide a solution?
I'm trying to deploy a Flask Web Application for Image Classification (Thus using TensorFlow) on Heroku. On attempting to deploy using "git push Heroku master", I get the following error message:
remote: -----> Python app
Requested runtime (Flask==1.1.2 remote:
Jinja2==2.11.2 remote: tensorflow==2.3.0 remote: Werkzeug==1.0.1) is
not available for this stack (heroku-18).
I am stuck here. How do we go about deploying a Flask application that uses TensorFlow on Heroku, then?
Create a runtime.txt in our main folder and write the python version you are using, like
python-3.7.10
I am trying to deploy a project on Heroku, the build is successful.
Here's the build log
-----> Python app detected
-----> Installing requirements with pip
-----> $ python manage.py collectstatic --noinput
73 static files copied to '/tmp/build_0e164445076c2ad03a67e962b1108c5b/static'.
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 54.7M
-----> Launching...
Released v7
https://odyssy.herokuapp.com/ deployed to Heroku
There are no errors in build log but the app is not working.
When I run heroku run python manage.py syncdb I face this error
mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/media'
The app is successfully running locally. This app uses photologue. When I run this locally a folder named "media" is created outside of the app directory, and this is also happening in heroku but heroku doesn't allow creating folders manually in root directory.
Is there any way to fix this?
Can I change the address of media folder in Photologue?
EDIT : Is there no way to deploy Django app with photologue on heroku?
I'm building a small Flask app that will have user login, and a few other pages that will allow the user to run queries against a database.
Using the Flask User basic app as an example, I put togther a skeleton of the app, and it is working fine locally. Then in an attempt to deploy at as my first Flask app on OpenShift, I follow the guide here (changing flaskapp.py to basic_app.py). For requirements.txt, I add in all the libraries that were required by Flask, Flask User, Flask Login, and some other libraries I will need such as lxml.
When I attempt git push, I get:
remote: Traceback (most recent call last):
remote: File "/var/lib/openshift/56c60ef92d5271a900000016/python/virtenv/bin/pip", line 12, in <module>
remote: load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
remote: File "/var/lib/openshift/56c60ef92d5271a900000016/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/__init__.py", line 148, in main
remote: return command.main(args[1:], options)
remote: File "/var/lib/openshift/56c60ef92d5271a900000016/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/basecommand.py", line 171, in main
remote: log_fp = open_logfile(log_fn, 'w')
remote: File "/var/lib/openshift/56c60ef92d5271a900000016/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/basecommand.py", line 200, in open_logfile
remote: os.makedirs(dirname)
remote: File "/var/lib/openshift/56c60ef92d5271a900000016/python/virtenv/lib64/python2.7/os.py", line 157, in makedirs
remote: mkdir(name, mode)
remote: OSError: [Errno 13] Permission denied: '/var/lib/openshift/56c60ef92d5271a900000016/.pip'
When running rhc app create prior to this, I did see the following:
Cloning into 'myflaskapp2'...
The authenticity of host 'myflaskapp2-pyderman.rhcloud.com ' can't be established.
RSA key fingerprint is ......
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myflaskapp2-pyderman.rhcloud.com' (RSA) to the list of known hosts.
Your application 'myflaskapp2' is now available.
The fact that it finished with 'your application is now available' though would suggest that things are OK with with the SSH key.
I've taken a look at this post, but it doesn't shed any light, as I don't think I am running a "DIY" application (whatever that is).
Any help much appreciated.
I know is late but I faced the same problem yesterday and I was able to solve it.
This happens when there's already a socket in the port your app is using. What to do? SSH into you server, kill your app process and push again.
Another option is that you're using the wrong port. You should use the port and IP from the environment variables (if you are using Python: OPENSHIFT_PYTHON_IP and OPENSHIFT_PYTHON_PORT)
About your second question: If you used a custom cartridge or use diy-0.1 cartridge then your app is running over diy. If you used python-2.6, 2.7 or 3.3 then is not.
So I'm trying to create an app with Flask and Heroku. I can run it with Foreman just fine, but after deploying to Heroku, the application error comes up and the heroku logs show:
heroku[web.1]: State changed from crashed to starting
heroku[web.1]: Starting process with command `python app.py`
app[web.1]: File "app.py", line 2, in <module>
app[web.1]: from flask import Flask, send_from_directory
app[web.1]: ImportError: No module named flask
Any idea on how this could happen? Thanks!
EDIT: Flask is in the requirements file and I see that it gets installed during the push to Heroku.
You probably need to add Flask (and any other external dependencies) to a requirements.txt and include it in your repo.
You can use 'pip freeze > requirements.txt" to create it with what ever packages you have installed in your environment at the moment.