0
工作我有具有低於瓶應用不上部署
web: gunicorn app
heroku ps:scale web=1
中的內容的應用的目錄結構是如下
Shopping List/
app/
__init__.py
other files
Procfile
requirements.tx
app.py
Designs/
html files
app.py的含量爲Procfile
的燒瓶中應用低於
from flask import Flask, render_template, request, flash
from app.forms import SignIn
app = Flask(__name__ ,template_folder='Designs')
#set up secret key for crsf
app.secret_key = "[email protected]$"
@app.route("/", methods = ["GET", "POST"])
def index():
sigin_form = SignIn()
if request.method == 'POST':
if sigin_form.validate() == False:
flash('Please fill up all fields.')
return render_template("index.html", form = sigin_form)
else:
return render_template("dashboard.html")
elif request.method == "GET":
return render_template("index.html", form = sigin_form)
@app.route("/signup")
def signup():
return render_template("signup.html")
@app.route("/dashboard")
def dashboard():
return render_template("dashboard.html")
app.run(debug=True)
收到的日誌信息
`2017-08-29T09:10:44.624949+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
2017-08-29T09:10:44.624951+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
2017-08-29T09:10:44.624951+00:00 app[web.1]: self.load_wsgi()
2017-08-29T09:10:44.624952+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
2017-08-29T09:10:44.624952+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2017-08-29T09:10:44.624954+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2017-08-29T09:10:44.624954+00:00 app[web.1]: self.callable = self.load()
2017-08-29T09:10:44.624955+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2017-08-29T09:10:44.624956+00:00 app[web.1]: return self.load_wsgiapp()
2017-08-29T09:10:44.624956+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2017-08-29T09:10:44.624957+00:00 app[web.1]: return util.import_app(self.app_uri)
2017-08-29T09:10:44.624957+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2017-08-29T09:10:44.624958+00:00 app[web.1]: raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
2017-08-29T09:10:44.624959+00:00 app[web.1]: ImportError: Failed to find application, did you mean 'app:application'?
2017-08-29T09:10:44.625125+00:00 app[web.1]: [2017-08-29 09:10:44 +0000] [8] [INFO] Worker exiting (pid: 8)
2017-08-29T09:10:44.659282+00:00 app[web.1]: [2017-08-29 09:10:44 +0000] [9] [INFO] Booting worker with pid: 9
2017-08-29T09:10:44.665221+00:00 app[web.1]: [2017-08-29 09:10:44 +0000] [9] [ERROR] Exception in worker process
2017-08-29T09:10:44.665224+00:00 app[web.1]: Traceback (most recent call last):
2017-08-29T09:10:44.665225+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
2017-08-29T09:10:44.665226+00:00 app[web.1]: ModuleNotFoundError: No module named 'app.py'
2017-08-29T09:10:44.665226+00:00 app[web.1]: __import__(module)
2017-08-29T09:10:44.665227+00:00 app[web.1]:
2017-08-29T09:10:44.665227+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2017-08-29T09:10:44.665228+00:00 app[web.1]:
2017-08-29T09:10:44.665229+00:00 app[web.1]: Traceback (most recent call last):
2017-08-29T09:10:44.665229+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
2017-08-29T09:10:44.665230+00:00 app[web.1]: worker.init_process()
2017-08-29T09:10:44.665231+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
2017-08-29T09:10:44.665231+00:00 app[web.1]: self.load_wsgi()
2017-08-29T09:10:44.665233+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2017-08-29T09:10:44.665234+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2017-08-29T09:10:44.665232+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
2017-08-29T09:10:44.665234+00:00 app[web.1]: self.callable = self.load()
2017-08-29T09:10:44.665235+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2017-08-29T09:10:44.665235+00:00 app[web.1]: return self.load_wsgiapp()
2017-08-29T09:10:44.665236+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2017-08-29T09:10:44.665236+00:00 app[web.1]: return util.import_app(self.app_uri)
2017-08-29T09:10:44.665237+00:00 app[web.1]: raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
2017-08-29T09:10:44.665237+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 356, in import_app
2017-08-29T09:10:44.665417+00:00 app[web.1]: [2017-08-29 09:10:44 +0000] [9] [INFO] Worker exiting (pid: 9)
2017-08-29T09:10:44.665242+00:00 app[web.1]: ImportError: Failed to find application, did you mean 'app:application'?
我不知道什麼是做錯了。該應用在本地運行正常。任何幫助欣然讚賞。