jquery - How to create a single python script to execure multiple scripts in flask framework -



jquery - How to create a single python script to execure multiple scripts in flask framework -

this question has reply here:

how split flask app multiple py files? 3 answers split python flask app multiple files 3 answers

i developing web page using jinja2 template , alsk framework .

my folder architecture follow

web |-->static |-->css |-->js |-->img |-->templates |-->test1 |-->alaram1.html |-->test2 |-->alarm2.html |-->modfunctions |-->test1 |-->main.py |-->test2 |-->main.py

i have separate main.py within test1 , test2 folders. of now, i'm getting within 'modfunctions->test1' folder , running python script , getting output on '0.0.0.0:5000/test1' . similarly, when 'modfunctions->test2', run main.py. getting output on '0.0.0.0:5000/test2'in browser.

but want single .py script using can run both test1 , test2 modules same time

here have main.py script

from flask import render_template, request, redirect flask import flask flask import render_template, request, redirect app = flask(__name__, template_folder='/home/web/templates', static_folder='/home/web/static') @app.route('/test1', methods=['get','post']) def test1(): if request.method == 'get': homecoming render_template('test1/alarm1.html') if request.method == 'post': homecoming render_template('test1/alarm1.html') if __name__ == "__main__": app.debug = true app.run(host='0.0.0.0', port=5000)

similarly test2-main.py

flask import render_template, request, redirect flask import flask flask import render_template, request, redirect app = flask(__name__, template_folder='/home/web/templates', static_folder='/home/web/static') @app.route('/test2', methods=['get','post']) def test2(): if request.method == 'get': homecoming render_template('test2/alarm2.html') if request.method == 'post': homecoming render_template('test2/alarm2.html') if __name__ == "__main__": app.debug = true app.run(host='0.0.0.0', port=5000)

please share solution

jquery python flask jinja2

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -