title: How to redirect after successful login and register in Flask-Security? And Error
body: <p>How to redirect with successful register to a different html page than Default:'/'
  redirect say to the profile page of the user logged in.</p>
  
  <p>and after registering I have this error </p>
  
  <blockquote>
    <p>AttributeError: 'NoneType' object has no attribute 'send'</p>
  </blockquote>
  
  <pre><code>Traceback (most recent call last):
  
    File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
  
    File "/usr/lib/python2.7/threading.py", line 754, in run
  
    File "/home/maharshi/.local/lib/python2.7/site-packages/werkzeug/serving.py", line 659, in inner
  
    File "/home/maharshi/.local/lib/python2.7/site-packages/werkzeug/serving.py", line 499, in serve_forever
  
    File "/usr/lib/python2.7/SocketServer.py", line 236, in serve_forever
  
    File "/usr/lib/python2.7/threading.py", line 585, in set
  
    File "/usr/lib/python2.7/threading.py", line 407, in notifyAll
  
  &lt;type 'exceptions.TypeError'&gt;: 'NoneType' object is not callable
  </code></pre>
  
  <p>The data gets registered but this error is still there.</p>
  
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from flask import render_template
  from flask import request, redirect, url_for
  from flask_security import Security, SQLAlchemyUserDatastore, UserMixin, RoleMixin, login_required
  import datetime
  
  
  #Create app
  app= Flask(__name__)
  app.config['DEBUG']= True
  app.config['SQLALCHEMY_DATABASE_URI']= 'postgresql://postgres:mah@localhost/pdb1'
  app.config['SECRET_KEY']= 'MaharshI'
  app.config['SECURITY_REGISTERABLE'] = True
  
  #Create database connection object
  db= SQLAlchemy(app)
  
  #Define models
  roles_users= db.Table('roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
      db.Column('role_id', db.Integer(), db.ForeignKey('role.id')))
  
  class Role(db.Model, RoleMixin):
      id= db.Column(db.Integer(), primary_key=True)
      name= db.Column(db.String(80), unique=True)
      description= db.Column(db.String(225))
  
  class User(db.Model, UserMixin):
      id = db.Column(db.Integer, primary_key=True)
      email = db.Column(db.String(255), unique=True)
      password = db.Column(db.String(255))
      active = db.Column(db.Boolean())
      confirmed_at = db.Column(db.DateTime())
      roles= db.relationship('Role', secondary=roles_users, backref=db.backref('user',lazy='dynamic'))
  
  #setup Flask-Security
  user_datastore= SQLAlchemyUserDatastore(db, User, Role)
  security= Security(app, user_datastore)
  
  # @app.before_first_request
  # def create_user():
  #   user_datastore.create_user(email='mah@m.com', password='pass')
  #   db.session.commit()
  
  @app.route('/')
  def home():
      return render_template('home.html')
  
  @app.route('/profile/&lt;email&gt;')
  @login_required
  def profile(email):
      user= User.query.filter_by(email=email).first()
      return render_template('profile.html', user=user)
  
  # SECURITY_POST_LOGIN_VIEW= 'snd.html'
  
  
  # @app.route('/login_form')
  # def login_form():
  #   SECURITY_POST_LOGIN_VIEW= '/templates/snd.html'
  #   return render_template(url_for(SECURITY_POST_LOGIN_VIEW))
  
  # @app.route('/post_user', methods=['POST'])
  # def post_user():
  #   user=User(request.form['email'], request.form['password'])
  #   db.session.add(user)
  #   db.session.commit()
  #   return redirect(url_for('home'))
  
  
  if __name__ == "__main__":
      app.run(host='0.0.0.0')
  </code></pre>