Harish Kayarohanam
Harish Kayarohanam

Reputation: 4014

Unable to route using blueprint Flask

I followed the instructions in http://flask.pocoo.org/docs/blueprints/#blueprints and tried to do the routing in another script other than the script in which I created the app object . But I get error as

"The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."

It just ignores the routing that I did in that script .

restservice = Blueprint('restservice', __name__,template_folder='templates')

@restservice.route('/')
def approot():
   render_template('timeline.html')

Upvotes: 1

Views: 322

Answers (1)

Asdine
Asdine

Reputation: 3046

Assuming that your blueprint is in a file called restservice.py, you need to add these lines in the file where you created the app object

from restservice import restservice as restModule
app.register_blueprint(restModule)

Upvotes: 1

Related Questions