![](/img/trans.png)
[英]Getting "ModuleNotFoundError: No module named 'app'" when deploying Flask app to Heroku
[英]getting module not found error after deploying flask app to heroku server
所以我让这个 flask 应用程序在我的Heroku server
上成功运行。 我刚刚在我的 flask 应用程序中添加了contact form
功能,并且在my local machine
上一切正常,但是在heroku
上部署应用程序后,它给了我错误。 我检查了heroku logs
,错误如下所示:
from forms import ContactForm
ModuleNotFoundError: No module named 'forms'
app.py (只是导入部分)
from flask import Flask, render_template, request, flash
from flask_mail import Mail, Message
from forms import ContactForm
forms.py
from flask_wtf import FlaskForm
from wtforms import TextAreaField, SubmitField, TextField
from wtforms import ValidationError, validators
class ContactForm(FlaskForm):
name = TextField("Name", [validators.Required("Please enter your fullname")], render_kw={"placeholder" : "Fullname"})
email = TextField("Email", [validators.Required("Please enter your email adrress"), validators.Email()], render_kw={"placeholder" : "Emaill"})
subject = TextField("Message", [validators.Required("Enter your subject")], render_kw={"placeholder" : "Subject"})
message = TextAreaField("Message", [validators.Required("Enter your message")], render_kw={"placeholder" : "Message "})
send_message = SubmitField("Send")
我的文件夹结构
档案
web: gunicorn app.app:app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.