0

How does this Flask work? I made application.py look like this:

from flask import Flask, redirect, render_template, request, url_for

import os
import helpers
from analyzer import Analyzer

app = Flask(__name__)

#@app.route("/")
#def index():
#    return render_template("index.html")

#@app.route("/search")
#def search():

# validate screen_name
#    screen_name = request.args.get("screen_name", "")
#    if not screen_name:
#        return redirect(url_for("index"))

# get screen_name's tweets
#    tweets = helpers.get_user_timeline(screen_name)

# TODO
#ensure there are proper tweets downloaded
#if tweets == None:
#    return redirect(url_for("index"))

 # absolute paths to lists
#positives = os.path.join(sys.path[0], "positive-words.txt")
#negatives = os.path.join(sys.path[0], "negative-words.txt")

# instantiate analyzer
#analyzer = Analyzer(positives, negatives)
#    positive, negative, neutral = 100.0, 0.0, 0.0

# for every tweet check positiveness
#score = 0
#for tweet in tweets:
#    score = analyzer.analyze(tweet)
##   if score > 0.0:
#        positive += 1
#    elif score < 0.0:
#        negative += 1
#    else:
#        neutral += 1


# generate chart
#chart = helpers.chart(positive, negative, neutral)

# render results
#return render_template("search.html", chart=chart, screen_name=screen_name)

In other words, the whole program is one big comment and when I write "flask run" I receive this information:

  • Serving Flask app "application"
  • Forcing debug mode on
  • Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
  • Restarting with stat
  • Debugger is active!
  • Debugger pin code: 128-557-285

And when I chose the web server from the sc50 IDE, I receive a web page with a search engine where after writing the screen name I receive a yellow circle. Whatever I change in the application.py, nothing changes.

Why?

1 Answer 1

0

Ok, just forget my question. I have mixed up with folders in sc50 io...

I was changing the wrong application.py file and the Flask run was always using this original one... unchanged...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .