【发布时间】:2021-08-31 21:47:10
【问题描述】:
这是我的应用程序根目录的样子:
flask-submission-form
├ app
│ ├ templates
│ │ ├ base.html
│ │ └ index.html
│ ├ app.py
│ ├ extensions.py
│ └ __init__.py
├ assets
│ └ css
│ │ ├ custom.css
│ │ └ main.css
├ .env
├ .gitignore
├ definitions.py
├ gulpfile.js
├ package-lock.json
├ package.json
├ postcss.config.js
├ Procfile
├ README.md
├ requirements.txt
└ tailwind.config.js
app/ 目录如下所示:
app
├ templates
│ ├ base.html
│ └ index.html
├ app.py
├ extensions.py
└ __init__.py
我的__init__.py 包含我的主应用代码,如下所示:
from flask import Flask, request, render_template
import os
from .extensions import register_extensions
def create_app():
app = Flask(__name__)
register_extensions(app)
@app.route("/", methods =["GET", "POST"])
def index():
if request.method == "POST":
# Do a Bunch of Stuff
我的app.py 看起来像这样:
from app import create_app
app = create_app()
我把这个放在我的Procfile:
web: gunicorn app.app:create_app()
但是当我尝试将其部署到 Heroku 时,我收到以下错误:
remote: ! Push failed: cannot parse Procfile.
remote: ! Please try pushing again.
remote: ! If the problem persists, see https://help.heroku.com/ and provide Request ID 28547bd1-bce5-f7f2-e770-b2cb7b73be26.
remote:
remote:
remote: !
remote: ! ## Warning - The same version of this code has already been built: fbbc38150c6a8d344932d53a7c40ae4880c288c8
remote: !
remote: ! We have detected that you have triggered a build from source code with version fbbc38150c6a8d344932d53a7c40ae4880c288c8
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
在给定我的应用程序结构的情况下,如何正确配置我的Procfile,以便正确部署它?如果有帮助,this is my repo。
【问题讨论】:
-
嘿,解码是什么,用utf-8做
标签: python flask heroku deployment