Commit 4259c8f8 authored by Petrus J.v.Rensburg's avatar Petrus J.v.Rensburg

Make 'auth' example deployable.

parent 7e8266a0
......@@ -14,7 +14,7 @@ app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
# Create in-memory database
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///sample.sqlite'
app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)
......@@ -135,15 +135,16 @@ def logout_view():
login.logout_user()
return redirect(url_for('index'))
if __name__ == '__main__':
# Initialize flask-login
init_login()
# Initialize flask-login
init_login()
# Create admin
admin = admin.Admin(app, 'Auth', index_view=MyAdminIndexView())
# Create admin
admin = admin.Admin(app, 'Auth', index_view=MyAdminIndexView())
# Add view
admin.add_view(MyModelView(User, db.session))
# Add view
admin.add_view(MyModelView(User, db.session))
if __name__ == '__main__':
# Create DB
db.create_all()
......
......@@ -4,13 +4,10 @@
<div class="row-fluid">
<h1>Flask-Admin example</h1>
<p class="lead">
Custom forms
Authentication
</p>
<p>
This example shows how you can define your own custom forms by using form rendering rules.
</p>
<p>
It also demonstrates general file handling as well as the handling of image files specifically.
This example shows how you can use Flask-Login for authentication. It is only intended as a basic demonstration, so please don't freak out when you see passwords being stored as plain text.
</p>
<a class="btn btn-primary" href="/"><i class="icon-arrow-left icon-white"></i> Back</a>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment