0
votes

I have been trying to fix this error using all sorts of methods and still could not find any error. What I'm doing is retrieving 2 strings from a HTML form and then send it over to my database as JSON. Here are the codes.

HTML Form:

<link rel="stylesheet" href="/static/css/loginstyle.css" type="text/css">
<form action="/registerUser" method="POST">
<div class="login">
    <div class="login-screen">
        <div class="app-title">
            <h1>Register</h1>
        </div>

        <div class="login-form">
            <div class="control-group">
                <input type="text" class="login-field" value="" placeholder="Username" name="username">
                <label class="login-field-icon fui-user" for="login-name"></label>
            </div>

            <div class="control-group">
                <input type="password" class="login-field" value="" placeholder="password" name="password">
                <label class="login-field-icon fui-lock" for="login-pass"></label>
            </div>

            <input type="submit" value="Register" class="btn btn-primary btn-large btn-block">
            <br>
        </div>
    </div>
</div>

Python Flask Code:

sys.setrecursionlimit(1500)
@app.route('/registerUser', methods=['POST'])
def register_user():
  if request.method == 'POST':
   idx = uuid.uuid4()
   uid = str(idx)
   username = request.form['username']
   password = request.form['password']
   password = password.encode('utf-8')
   sha1 = hashlib.sha1()
   sha1.update(password)
   password = sha1.hexdigest()
   data = {'uid': uid, 'username': username, 'password': password}
   db.child("users").child(username).set(data)
   return render_template('/login.html')
  else:
   error = 'What are you trying to do?'
   return render_template('/login.html', error = error)

Error:

RecursionError: maximum recursion depth exceeded while calling a Python object

1
Which line cause this error? - stamaimer
Have you tried inserting logging statements so you can trace the exact sequence of execution? - John Gordon

1 Answers

0
votes

Solved by changing python version to a lower one.