CoreyMSchafer / code_snippets

MIT License
10.35k stars 17.56k forks source link

Error in Flaskblog.py #110

Open sa123123 opened 4 years ago

sa123123 commented 4 years ago

Sir, My code have an error in python file as:-No module named forms found... from flask import Flask,render_template,url_for from forms import RegistrationForm,LoginForm

App=Flask(name) App.config['SECRET_KEY']='' posts=[ { 'author':'Sandeep', 'title':'About Pandemic', 'content':'COVID-19 is spreading at a very high rate', 'date':'May 14 2020' }, { 'author':'Joe', 'title':'About vaccine', 'content':'Vaccine can be founded based on some microbiology rules', 'date':'May 15 2020' }

]

@App.route("/") @App.route("/home") def home(): return render_template('Home.html',posts=posts)

@App.route("/about") def about(): return render_template('About.html',title='About')

@App.route("/register") def register(): form=RegistrationForm() return render_template('register.html',title='Register',form=form)

@App.route("/login") def login(): form=LoginForm() return render_template('login.html',title='login',form=form)

if name=="main": App.run(debug=True)

joeleger commented 4 years ago

Do you have a file in your project named forms.py that contains two class's named RegistrationForm and LoginForm? You need this. It is documented and discussed in the videos and in the code contained herein.

Best wished Joe

sa123123 commented 4 years ago

Thanks for your reply,Sir

Rajendro1 commented 4 years ago

close this issue