def login(): if request.method == "GET": if "logged_in" in session and session["logged_in"]: return render_template(url_for("home")) else: return render_template("login.html") else: return "not get"
def home() : # Find data mars_info = mongo.db.mars_info.find_one() return render_template("index.html", mars_info=mars_info) #Route that will use the scrape function @app.route("/scrape") def scrape(): #Run the scraped functions mars_info = mongo.db.mars_info mars_data = scrape_mars.scrape_mars_news() mars_data = scrape_mars.scrape_mars_image() mars_data = scrape_mars.scrape_mars_facts() mars_data = scrape_mars.scrape_mars_weather() mars_data = scrape_mars.scrape_mars_hemisspheres() mars_info.update({}, mars_data, upsert=True) return redirect("/") if __name__ == "__main__": app.run(debug=True)
def search(search): if request.method == 'POST': searchTerm = request.form['search_term'].replace(' ', '-') return redirect(url_for('search', search=searchTerm)) return render_template("result.html", title_list=scrape(search), pageTitle="%s News Results" % (search))
def hello_world(): usergreet = request.args.get('greet') username = request.args.get('name') if usergreet is None or usergreet == "": usergreet = "Hello" if username is None or username == "": username = "******" greeting = "%S, %s!" % (usergreet, username) return render_template('index.html', greet=greeting)
def create_store(): if request.method == 'POST': name = request.form['name'] url_prefix = request.form['url_prefix'] tag_name = request.form['tag_name'] query = json.loads(request.form['query']) Store(name, url_prefix, tag_name, query).save_to_mongo() return render_template('stores/new_store.html')
def add_results(): form = StudentForm() if form.validate_on_submit(): student = Student( name=form.name.data, physics=form.physics.data, maths=form.maths.data, chemistry=form.chemistry.data, ) db.session.add(student) db.session.commit() return redirect(url_for('add_results')) else: return render_template('home.html', form=form)
def hello(): form = PlateGenFrontend(request.form) print form.errors if request.method == 'POST': kle_rawdata = request.form['kle_form'] print name if form.validate(): flash('KLE string stored') else: flash('Please ') return render_template('hello.html', form=form)
def home(): """Home page of app with form""" # Create form form = ReusableForm(request.form) # On form entry and all conditions met if request.method == 'POST' and form.validate(): # Extract information username = request.form['username'] Rank1 = int(request.form['Rank1']) Rank2 = int(request.form['Rank2']) Rank3 = int(request.form['Rank3']) Rank4 = int(request.form['Rank4']) # Send template information to index.html return render_template('index.html', form=form)
def edit_store(store_id): store = Store.get_by_id(store_id) if request.method == 'POST': name = request.form['name'] url_prefix = request.form['url_prefix'] tag_name = request.form['tag_name'] query = json.loads(request.form['query']) store.name = name store.url_prefix = url_prefix store.tag_name = tag_name store.query = query store.save_to_mongo() return redirect(url_for('.index')) return render_template('stores/edit_store.html', store=store)
from Flask import Flask,request,redirect,render_template app = Flask(__name__)#cretes a Flask app app.config[DEBUG] = True tasks = [] @app.route('/todos',methods=['POST','GET']) def todos(): if request.method='POST': task = request.form['task' tasks.append(task)] return render_template('todos.hml',title="TODOs",tasks=tasks) app.run()
def formpage(): return render_template('formpage.html')
def index(): if request.method == 'POST': task = request.form('task') tasks.append(task) return render_template('todos.html', title='Get It Done', tasks=tasks)
def hello_world(): greeting = "Hello World" render = render_template('index.html', greet=greeting) return render
def imageslog(): return render_template('ImagesLog.html')
def send_reset_email(user): token = user.get_reset_password_token() send_email('Reset Password',sender=app.config['MAIL_USERNAME'],recepients=[user.email],text_body=render_template('auth/reset_password.txt',user=user, token=token),html_body=render_template('auth/reset_password.html',user=user, token=token))
def intex(): return render_template("index.html")
def hello_get(): return render_template('hello_form.html')
def home(): return render_template("home.html")
def login(): if request.method == "GET": return render_template("login.html") else: return "HI"
def results(): data = Student.query.all() return render_template('results.html', data=data)
def home(): return render_template("index.html")
def home(): if "logged_in" in session and session["logged_in"]: return render_template("home.html") else: return redirect(url_for("login"))
def homepage(): return render_template('index.html')
def jobs(): return render_template('index.html')
paragraph_text_2 = "" featured_image_url = "" mars_weather = "" mars_facts = "" hemi_title_1 = "" hemi_img_1 = "" hemi_title_2 = "" hemi_img_2 = "" hemi_title_3 = "" hemi_img_3 = "" hemi_title_4 = "" hemi_img_4 = "" return render_template("index.html", news_title = news_title,\ paragraph_text_1 = paragraph_text_1, paragraph_text_2 = paragraph_text_2,\ featured_image_url = featured_image_url, mars_weather = mars_weather,\ mars_facts = mars_facts, hemi_title_1 = hemi_title_1, hemi_img_1 = hemi_img_1,\ hemi_title_2 = hemi_title_2, hemi_img_2 = hemi_img_2, hemi_title_3 = hemi_title_3,\ hemi_img_3 = hemi_img_3, hemi_title_4 = hemi_title_4, hemi_img_4 = hemi_img_4) @app.route('/scrape') def scrape_mars_data(): scrape_results = scrape_mars.scrape() mars_data.replace_one({}, scrape_results, upsert=True) return redirect('http://localhost:5000/', code=302) if __name__ == '__main__': app.run()
def videoLive(): return render_template('video.html')
def index(): return render_template('home.html')
def index () : return render_template('index .html')
def index(): return render_template("index.html")
def html_page(page_name): return render_template(page_name)
def login(): if request.method == "POST": user = request.form["nm"] return redirect(url_for("user", usr=user)) else: return render_template("login.html")