added spam removal
This commit is contained in:
30
web/app.py
30
web/app.py
@@ -2,6 +2,7 @@ from flask import Flask, render_template, request
|
||||
from flask_bootstrap import Bootstrap
|
||||
import db
|
||||
import config
|
||||
import utils
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(config.BaseConfig)
|
||||
@@ -20,15 +21,32 @@ def hello_world():
|
||||
@app.route('/generate', methods=["POST"])
|
||||
def generate():
|
||||
try:
|
||||
ip = utils.get_ip(request)
|
||||
pass
|
||||
except:
|
||||
ip = ''
|
||||
pass
|
||||
|
||||
if ip != '5.135.188.148' or ip == '178.32.58.160':
|
||||
try:
|
||||
error = None
|
||||
identifier = my_db.get_identifier(request.form['name'])
|
||||
pass
|
||||
except StopIteration:
|
||||
identifier = ''
|
||||
error = 'Maximum entry limit reached - please contact Sean or Joe'
|
||||
pass
|
||||
else:
|
||||
error = None
|
||||
identifier = my_db.get_identifier(request.form['name'])
|
||||
pass
|
||||
except StopIteration:
|
||||
identifier = ''
|
||||
error = 'Maximum entry limit reached - please contact Sean or Joe'
|
||||
pass
|
||||
identifier = 'F'
|
||||
|
||||
return render_template('generate.html', brew_name=brew_name, brew_month=brew_month, identifier=identifier, error=error)
|
||||
|
||||
|
||||
@app.route('/getip')
|
||||
def getip():
|
||||
return utils.get_ip(request)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
|
||||
Reference in New Issue
Block a user