Try ‘python -m flask run –help’ for help.
Error: While importing ‘app’, an ImportError was raised:
Traceback (most recent call last):
File “C:Userslula_OneDriveDocumentosprojeto_pythonprojetos_portifolioPortifolio.venvlibsite-packagesflaskcli.py”, line 245, in locate_app
import(module_name)
File “C:Userslula_OneDriveDocumentosprojeto_pythonprojetos_portifolioPortifolioapp_init_.py”, line 2, in
from app.routes.main_routes import main
File “C:Userslula_OneDriveDocumentosprojeto_pythonprojetos_portifolioPortifolioapproutes_init_.py”, line 5, in
from . import main_routes, project_routes, blog_routes, contact_routes
File “C:Userslula_OneDriveDocumentosprojeto_pythonprojetos_portifolioPortifolioapproutesmain_routes.py”, line 4, in
from app.forms.contact_forms import ContactForm
ModuleNotFoundError: No module named ‘app.forms.contact_forms’
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired, Email
class ContactForm(FlaskForm):
name = StringField(‘Name’, validators=[DataRequired(message=”Name is required.”)])
email = StringField(‘Email’, validators=[DataRequired(message=”Email is required.”), Email(message=”Invalid email address.”)])
message = TextAreaField(‘Message’, validators=[DataRequired(message=”Message is required.”)])
submit = SubmitField(‘Send’)
I’m getting this error when I run flask run, which I didn’t do the import. Would anyone know where I can fix this import?
Luiz Valença Filho is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.