Difficulty in deploying ML model to Heroku - python

Any help would be much appreciated. I created a repository here where all files are linked. I'm currently trying to learn how to deploy an ML model to Heroku. This is a pretty simple model and I was following along with a YouTube tutorial. When I run 'python app.py' on my terminal, the local server does run correctly, showing the exact interface I want.
When trying to deploy it on Heroku, I linked my GitHub repository and selected 'Deploy Branch'; Here, Heroku states that the app was successfully deployed. HOWEVER, when I then try to view, a page comes up stating Application Error.
As mentioned, I'm really not sure what's going wrong and would appreciate any guidance to get this working – I'd like to deploy other ML models I've been working on and getting this preliminary one running would be a huge help. Any advice?
Thanks!

It seems like you have forgotten to create the Procfile. This is necessary for Heroku as it tells Heroku how to startup your application on it's servers.
Since you're server file is app.py and the Flask app is app as well, the following would be the contents of the Procfile
web: gunicorn app:app
Also update your requirements.txt file by adding gunicorn, as an example what i had was
gunicorn==20.1.0
For more information about the Procfile see https://devcenter.heroku.com/articles/procfile
I have deployed this personally and it works fine now 😁

Related

Python WebApp Facing Running Problems In Heroku

I'm a newbie and learning Heroku systems. I want to run this CMS on Heroku. I ran it many times on my machine and on others' servers. But I don't have servers all the time. I want to make it on Heroku for contestants.
As always I tried to follow the docs of this app. The requirements and setup part runs fine. But the database creation and other parts I couldn't cope up with. As a result, it shows an application error. The app also uses Postgres. But the commands given for ubuntu, I don't know how I can make them in Heroku.
If it sounds stupid question please pardon me. If I have to learn about something please give me some resources to learn.
Or It it is not possible to run this app with heroku, is there any SSH tunelling trick to just make the contestant part online with heroku Or is there any way to just tunnel my localhost to heroku web app domain? Thank You Very Much.

Deploying Dash app in Azure, remains Loading

I`m trying to deploy a simple Dash App in Azure, and I followed the tutorial below:
https://www.phillipsj.net/posts/deploying-dash-to-azure-without-using-docker/
It works perfectly in my localhost, but when I try to deploy it in Azure the site shows only the message: Loading...
If I try to deploy a Flask App in Azure (https://medium.com/#nikovrdoljak/deploy-your-flask-app-on-azure-in-3-easy-steps-b2fe388a589e) it works perfectly fine.
Could you please give me any indication why this migh happen? Is there any difference between deploying Flask and Dash in Azure?
Thank you in advance
First of all, I recommend you test all the applications locally before you publish it to the Azure Web App. If it does not work fine locally, fix it until it succeeds. For the link you provided in the question, I test it on my side and it does not work fine. With checking, it loses the package dash-renderer. So you can install it and freeze it into the requirements and test it locally. Or directly append it into the requirements.txt:
dash-renderer==0.13.0
Then publish it to the Azure Web App and it will work fine like this:
If you have any more questions, please let me know.

Heroku build docker image with --no-cache option

I'm trying to update a Docker image on my Heroku app.
I just used the following commands from this documentation article: https://devcenter.heroku.com/articles/container-registry-and-runtime
heroku login
heroku container:login
heroku container:push web
heroku container:release web
heroku open
This set of commands worked perfectly the first time, except that I got an error about not being able to map to the $PORT variable I figured out how to fix the problem (I'm using Flask), so I updated my api.py (I named it api.py instead of app.py), and now I want to push the updates to the Heroku app. But running through those commands, it seems to use the cache (I've had this problem on my local machine before; I have to use the --no-cache option when I buid). I don't really know when it's being built on Heroku.
Anyways, at the end of the release command, it says: The process type web was not updated, because it is already running the specified docker image.
How do I get it to update?
Just for the people out there looking at this, it turned out it was a simple mistake in my Dockerfile.
Basically, I was using git clone to get my app files. Because of this, I had no ADD commands anywhere, so all the results were being cached by docker.
All I had to do was run ADD instead of git clone to import my project files, and now everything runs perfectly well :)

Django app on Heroku, deployed successfully but could not be served

I have built a simple blog app with Django by following a video and deployed it to Heroku by following another video.
The app works fine locally, but it is not working online.
Heroku gives me this error message:
This app has no process types yet
Add a Procfile to your app in order to define its process types.
I had already added a Proclife created with Notepad with these contents:
web: gunicorn mysite.wsgi
But how can I add another Procfile to an app already deployed to Heroku?
Where should I place it?
Yeah that's correct. It required file 'Procfile' in the project root directory. I have created one with below content
web: gunicorn <your-app.wsgi> -b 0.0.0.0:$PORT -w 10
And followed the below link https://devcenter.heroku.com/articles/procfile where everything is mentioned to deploy the code to heroku.
Its been long time for me working with heroku that too with test app so I am not sure if it got changed after that. But I think just following the link will work just fine.

Minimal working heroku django app

I have been having some problems with deploying my django app to heroku. I have triple checked the getting started guide several times and I am getting quite frustrated. The most annoying thing is that I don't get any errors during deployment, in heroku logs or during local deployment. Here is an SO question with more details.
The easiest solution at this stage would probably be to reverse engineer a minimal working django app which I could push straight to my heroku repo without any extra config.
(The smaller the app the better a simple <h1>hello world</h1> would do but it would need to include venv, requirements.txt and of course Procfile)
Thanks
Take your pick. Either of these should work for you.
https://github.com/auzigog/django-template-heroku
https://github.com/cyberdelia/django-heroku-template
You can try http://django.ironcoder.me - visual composer, which deploys working Django app to your heroku account.

Categories

Resources