diff --git a/docs/index.rst b/docs/index.rst
index eacb4dd81b87c260e76332e758aaa8d249cf9fb9..1ab6e66ccaa9bedb929b75cdea2ccc38f09b4707 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -31,12 +31,12 @@ required configuration options:
     from flask_simpleldap import LDAP
 
     app = Flask(__name__)
-    ldap = LDAP(app)
-
     app.config['LDAP_BASE_DN'] = 'OU=users,dc=example,dc=org'
     app.config['LDAP_USERNAME'] = 'CN=user,OU=Users,DC=example,DC=org'
     app.config['LDAP_PASSWORD'] = 'password'
 
+    ldap = LDAP(app)
+
     @app.route('/ldap')
     @ldap.login_required
     def ldap_protected():