Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deploy flask app on Heroku
#1
Hi i have written a flask app that will allow user to upload images and those images will be saved in my local drive.

I am trying to upload that app into heroku, and everything went fine but when i run this app i receive

Error:
2019-02-20T09:00:56.045524+00:00 heroku[web.1]: Process exited with status 3 2019-02-20T09:00:57.674515+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=04553316-6 517-49c4-b12b-814864271411 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:00.154847+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=ff15a32f-a 52f-4d00-909c-5f0ee8b6ae66 fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:01.773539+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=c22471c8-2 da5-49ee-8714-77566d29bca3 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:03.030058+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=2043e88a-2 4f2-470c-ae23-0ab0d5591e62 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:04.336006+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=348d1a34-9 ac3-4f41-a272-37b7722662c2 fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:05.695752+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=864ef90e-0 23f-4ded-9470-74ac624a317a fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:06.802624+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=5ab704ac-8 dae-48bf-a46a-4753f181a85e fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:07.877928+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=46759c8a-0 b85-4f18-8507-fffc669e7ac8 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:09.099555+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=f13fc550-f 2b0-4687-a65c-51711a0d060a fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:11.180466+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=c8ff8aec-1 aab-47da-9fe4-53b2b8f72f94 fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:13.308963+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=8c87348c-a 210-4bd7-8059-da14ed1afdd3 fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:17.789765+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=d25beb2d-8 666-4517-ba65-b28bbf2be394 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:19.656581+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=4deb9b2d-9 03f-4785-a842-3009280ec1c2 fwd="121.243.22.130" dyno= connect= service= status=5 03 bytes= protocol=https 2019-02-20T09:01:21.015007+00:00 heroku[router]: at=error code=H10 desc="App cra shed" method=GET path="/" host=images99acres.herokuapp.com request_id=68b934d9-8 99f-4352-ba79-474726d2b406 fwd="124.124.36.130" dyno= connect= service= status=5 03 bytes= protocol=https
it says service crashed.

This is my python code


from flask import Flask, redirect, render_template, request, session, url_for
from flask_dropzone import Dropzone
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch_request_class

import os

app = Flask(__name__)
dropzone = Dropzone(app)


app.config['SECRET_KEY'] = 'supersecretkeygoeshere'

# Dropzone settings
app.config['DROPZONE_UPLOAD_MULTIPLE'] = True
app.config['DROPZONE_ALLOWED_FILE_CUSTOM'] = True
app.config['DROPZONE_ALLOWED_FILE_TYPE'] = 'image/*'
app.config['DROPZONE_REDIRECT_VIEW'] = 'results'

# Uploads settings
app.config['UPLOADED_PHOTOS_DEST'] = os.getcwd() + '/uploads'

photos = UploadSet('photos', IMAGES)
configure_uploads(app, photos)
patch_request_class(app)  # set maximum file size, default is 16MB


@app.route('/', methods=['GET', 'POST'])
def index():
    
    # set session for image results
    if "file_urls" not in session:
        session['file_urls'] = []
    # list to hold our uploaded image urls
    file_urls = session['file_urls']

    # handle image upload from Dropszone
    if request.method == 'POST':
        file_obj = request.files
        for f in file_obj:
            file = request.files.get(f)
            
            # save the file with to our photos folder
            filename = photos.save(
                file,
                name=file.filename    
            )

            # append image urls
            file_urls.append(photos.url(filename))
            
        session['file_urls'] = file_urls
        return "uploading..."
    # return dropzone template on GET request    
    return render_template('index.html')


@app.route('/results')
def results():
    
    # redirect to home if no images to display
    if "file_urls" not in session or session['file_urls'] == []:
        return redirect(url_for('index'))
        
    # set the file_urls and remove the session variable
    file_urls = session['file_urls']
    session.pop('file_urls', None)
    
    return render_template('results.html', file_urls=file_urls)

if __name__=="__main__":
    app.run(debug=True)

#app.run(debug=True)
this is my procfile:
web: gunicorn app:app
web: gunicorn run:app
this is the tutorial from where i am learning :https://medium.com/@gitaumoses4/deploying-a-flask-application-on-heroku-e509e5c76524

Attached Files

.txt   requirements.txt (Size: 161 bytes / Downloads: 354)
.py   app.py (Size: 2.11 KB / Downloads: 432)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Star Leapcell: The Python-Friendly Alternative to Heroku + Airtable Hybrid IssacChan 1 468 Feb-01-2024, 06:00 AM
Last Post: Athi
  Deployed Spider on Heroku: How do I email downloaded files? JaneTan 2 1,567 Mar-24-2022, 08:31 AM
Last Post: JaneTan
  Using Python Embedded with Flask Restplus API : to deploy on IIS gaurav_umang 1 2,261 Nov-18-2021, 01:35 AM
Last Post: Larz60+
  Heroku Error H10 jamesaarr 1 2,027 Oct-21-2021, 03:43 PM
Last Post: jamesaarr
Question Deploy Flask apps on Windows... SpongeB0B 2 4,054 Aug-08-2021, 09:12 AM
Last Post: ndc85430
  Importing Postgres Heroku from AWS S3 Drone4four 0 1,807 May-27-2021, 01:09 PM
Last Post: Drone4four
  Django project deployed to Heroku: Postgres security Drone4four 0 1,942 Mar-26-2021, 10:17 AM
Last Post: Drone4four
Exclamation Quick Help - Deploy Flask App on Google Cloud Madoo 0 1,481 Nov-07-2020, 01:43 PM
Last Post: Madoo
  Scrape script when deployed on heroku not giving expected outcomes alok001 1 3,257 Oct-19-2019, 12:39 PM
Last Post: alok001
  flask app to save images locally when deployed on heroku not working Prince_Bhatia 1 5,273 Feb-20-2019, 11:59 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020