db.init_app(app) db.create_all(app=app) migrate = Migrate(app, db, render_as_batch=True) # create celery object celery = make_celery(app) # admin = Admin(app, name='Dashboard') # admin.add_view(ModelView(Users, db.session)) admin = Admin(app, name='Dashboard') admin.add_view(AdminView(Users, db.session)) admin.add_view(AdminView(Polls, db.session)) admin.add_view(AdminView(Options, db.session)) admin.add_view(TopicView(Topics, db.session)) @app.route('/') def home(): return render_template('index.html') @app.route('/signup', methods=['GET', 'POST']) def signup(): if request.method == 'POST': # get the user details from the form email = request.form['email'] username = request.form['username'] password = request.form['password']
# load config from the config file we created earlier votr.config.from_object('config') # create the database db.init_app(votr) # db.create_all(app=votr) migrate = Migrate(votr, db, render_as_batch=True) # create celery object celery = make_celery(votr) admin = Admin(votr, name='Dashboard', index_view=TopicView(Topics, db.session, url='/admin', endpoint='admin')) admin.add_view(AdminView(Users, db.session)) admin.add_view(AdminView(Polls, db.session)) admin.add_view(AdminView(Options, db.session)) admin.add_view(AdminView(UserPolls, db.session)) @votr.route('/') def home(): return render_template('index.html') @votr.route('/signup', methods=['GET', 'POST']) def signup(): if request.method == 'POST':
# load config from the config file we created earlier if os.getenv('APP_MODE') == "PRODUCTION": votr.config.from_object('production_settings') else: votr.config.from_object('config') db.init_app(votr) # Initialize the database db.create_all(app=votr) # Create the database migrate = Migrate(votr, db, render_as_batch=True) # create celery object celery = make_celery(votr) admin = Admin(votr, name='Dashboard', index_view=TopicView(Topics, db.session, url='/admin', endpoint='admin')) admin.add_view(AdminView(Users, db.session)) admin.add_view(AdminView(Polls, db.session)) admin.add_view(AdminView(Options, db.session)) admin.add_view(AdminView(UserPolls, db.session)) @votr.route('/') def home(): return render_template('index.html') @votr.route('/signup', methods=['GET', 'POST']) def signup(): if request.method == 'POST':