Category "flask"

How to load config file in python from an external module

I have a config module (myConfig.py) present in a library for which i created a standard distribution package using setuptools. --configPackage | | -

How to use flask_cli

How to use FlaskCLi with flask application in a virtualenv I created a folder called app and activated the virtualenv and created an app.py file with the follo

Different types of POST requests in the same route in Flask

I want to have a page on my website where you have multiple buttons that send a different POST request to modify some part of my database. Currently, only the

Flask Blueprint AttributeError: 'module' object has no attribute 'name' error

My API is being built to allow developers to extend it's functionality. My plan is to do this by providing an "extensions" directory where they can drop in Blue

How to enable CORS in flask

I am trying to make a cross origin request using jquery but it keeps being reject with the message XMLHttpRequest cannot load http://... No 'Access-Control

How to pass multiple templates to flask.render_template()

I'm trying to deploy a flask app and I want a flask.render_template() method passed with a list of html files. Here I see it's eligible. http://flask.pocoo.org/

Blueprint and factory pattern work together?

I am working on a restful service using flask-restful, and I want to leverage both factory pattern and blueprint in my project. in app/__init__.py I have a crea

Redirect to another page in blueprints

Im looking for a way to redirect to another page while using flask blueprints from flask import Blueprint, request, render_template, redirect, url_for import j

Dynamically generate Flask routes

I am trying to dynamically generate routes in Flask from a list. I want to dynamically generate view functions and endpoints and add them with add_url_rule. T

How to wire up migrations in Flask with declarative base?

I'm using the declarative Base in flask_sqlalchemy. In my database.py file I have the following: from sqlalchemy import create_engine # from sqlalchemy.orm imp

Using <input> inside for loop in jinja flask

I am struggling to figure out how to access individual <input> elements, that have been created through a for loop. For example: <form id="score" metho

Changing the active class of a link with the twitter bootstrap css in python/flask

I got the following html snippet from my page template.html. <ul class='nav'> <li class="active"><a href='/'>Home</a></li>

AssertionError: View function mapping is overwriting an existing endpoint function: main

Does anyone know why I can't overwrite an existing endpoint function if i have two url rules like this app.add_url_rule('/', view_func=Main.as

Insert a document with Flask-PyMongo

I have a MongoDB database and I want to use Flask-PyMongo to work with it in my Flask app. How do I add a database and a collection so I can add user documents

flask just refresh templated portion of page

I have a simple flask app that uses templates. Every time I click somewhere on the navigation (in the base.html) it refreshes the entire page, I'd rather it j