Issue
I'm trying to deploy my flask app at Heroku but I am facing a problem with Procfile. I was reading an article where there have this as file.
app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "<h1>Hello, World</h1>"
Then in Procfile it's like that:
web: gunicorn app:app
And it work, Tough me it's not the case, My folder structure is like that:
In flask_simple_app folder
├── run.py
└── simple_app
├── __init__.py
├── routes.py
├── static
│ └── style.css
└── templates
├── base.html
└── home.html
run.py contain following lines:
from simple_app import app
if __name__ == '__main__':
app.run()
init.py contain following lines:
from flask import Flask
app = Flask(__name__)
from simple_app import routes
routes.py contain following lines:
from simple_app import app
from flask import render_template
@app.route("/")
def home():
return render_template('home.html')
So my question is to know where I should put Procfile and how I'm gonna write this:
web: gunicorn ...:...
Solution
It should be:
web: gunicorn module_name_where_app_instance_exists:name_of_the_app_instance
In your case:
web: gunicorn run:app
Answered By - alecor Dev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.