Ejemplo n.º 1
0
def start_app_run():
    port = int(os.environ.get('PORT', 1234))
    if not os.environ.get('DEV'):
        debug = True
        host = "127.0.0.1"
        ur = False
    else:
        debug = False
        host = "0.0.0.0"
        ur = False  # to avoid duplicate output in start_collecting_data thread
    app.run(host=host, port=port, debug=debug, use_reloader=ur)
Ejemplo n.º 2
0
def start_app_run():
    port = int(os.environ.get('PORT', 1234))
    if not os.environ.get('DEV'):
        debug = True
        host = "127.0.0.1"
        ur = False
    else:
        debug = False
        host = "0.0.0.0"
        ur = False  # to avoid duplicate output in start_collecting_data thread
    app.run(host=host, port=port, debug=debug, use_reloader=ur)
Ejemplo n.º 3
0
from flask import Flask
from app_config import route, app

if __name__ == '__main__':
    print("=====================================" * 2)
    print(app.url_map)
    print("=====================================" * 2)
    app.run()
Ejemplo n.º 4
0
from app_config import app
from controller import blue_prints

for bp in blue_prints:
    app.register_blueprint(bp[0], url_prefix=bp[1])


@app.route('/')
def hello_world():
    return 'Hello World!'


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)
Ejemplo n.º 5
0
def main():
    port = int(os.environ.get("PORT", 8000))
    host = "0.0.0.0"
    # from waitress import serve
    # serve(app, host=host, port=port)
    app.run(host=host, port=port)
Ejemplo n.º 6
0
#     return send_file(os.path.join(app.config['STATIC_FOLDER'], 'index.html'))


# @app.route('/<path:path>')
# def serve_static(path):
#     try:
#         return send_from_directory(app.config['STATIC_FOLDER'], path)
#     except NotFound:
#         return serve_home_page()


if __name__ == "__main__":
    if len(sys.argv) > 1:
        if sys.argv[1] == '--debug':
            debug_mode = True
            print('Debug mode is on!')
        if sys.argv[1] == "--profile":
            from werkzeug.middleware.profiler import ProfilerMiddleware
            from app_config import DATADIR

            app.config['PROFILE'] = True
            profiles_dir = os.path.join(DATADIR, "profiles")
            if not os.path.isdir(profiles_dir):
                os.mkdir(profiles_dir)
            app.wsgi_app = ProfilerMiddleware(app.wsgi_app,
            restrictions=[100],
            profile_dir=profiles_dir)
        app.run(debug=True, port=13000)
    else:
        app.run(threaded=True, port=13000)
Ejemplo n.º 7
0
            "id": new_detail.id,
            "name": new_detail.name,
            "amount": new_detail.amount,
            "frequency": new_detail.frequency,
            "is_level_freq_changed": new_detail.is_level_freq_changed,
            "level": new_detail.level,
            "symptom_frequency": new_detail.symptom_frequency,
            "date": new_detail.date
        }
        return {"Success": details}

    alldetails = Remedy.query.all()

    details = []
    for new_detail in alldetails:
        details.append({
            "id": new_detail.id,
            "name": new_detail.name,
            "amount": new_detail.amount,
            "frequency": new_detail.frequency,
            "is_level_freq_changed": new_detail.is_level_freq_changed,
            "level": new_detail.level,
            "symptom_frequency": new_detail.symptom_frequency,
            "date": new_detail.date
        })
    return {"Remedy Details": details}


if __name__ == '__main__':
    app.run(debug=True)
Ejemplo n.º 8
0
from app_config import app
from controller import blue_prints
from flask import redirect, url_for

for bp in blue_prints:
    app.register_blueprint(bp[0], url_prefix=bp[1])


@app.route('/')
def hello_world():
    return "<script>location.href='/bank'</script>"


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8082)
Ejemplo n.º 9
0
		user_dir = Path(app.config['UPLOAD_FOLDER']) / user_id
		project_details = get_project_details(user_dir)
	else:
		project_details = None
	project_details_json = json.dumps(project_details)
	return project_details_json


@app.route('/delete_project', methods=['POST'])
def delete_project():
	"""
	This route is used to delete a project.
	:return:
	"""
	if 'uid' in session:
		user_id = session['uid']
		project_id = request.form["pid"]
		project_directory = Path(app.config['UPLOAD_FOLDER']) / session['uid'] / project_id

		shutil.rmtree(project_directory)
		user_dir = Path(app.config['UPLOAD_FOLDER']) / user_id
		project_details = get_project_details(user_dir)
	else:
		project_details = None
	project_details_json = json.dumps(project_details)
	return project_details_json


if __name__ == "__main__":
	app.run(threaded=True)
Ejemplo n.º 10
0
from resources.root import RootResource
from resources.device import DeviceResource, DevicesResource
from resources.location import LocationResource
from app_config import api, app, db
    
api.add_resource(RootResource, '/')
api.add_resource(DeviceResource, '/device/<string:device_id>')
api.add_resource(DevicesResource, '/devices')
api.add_resource(LocationResource, '/locations/<string:device_id>')

db.create_all()

if __name__ == '__main__':
    app.run(port=5000, debug=True)
Ejemplo n.º 11
0
    return render_template('page3.html')


@app.route('/login/', methods=['POST', 'GET'])
def login():
    if request.method == "POST":
        username = request.form.get('username')
        result = db.session.query(User).filter_by(username=username)
        if result:
            try:
                password = request.form.get('password')
                if result.first().password == password:
                    session['user_id'] = result.first().id  #找到登陆人
                    return jsonify({'data': '登陆成功!', 'code': 200})
                else:
                    return jsonify({'data': '登陆失败!密码错误!', 'code': 204})
            except:
                return jsonify({'data': '该用户不存在!', 'code': 204})
    else:
        return render_template('login.html')


@app.route('/logout/', methods=['POST', 'GET'])
def logout():
    del session['user_id']
    return redirect('/login/')


if __name__ == "__main__":  #程序入口
    app.run(port=8388, debug=True)
Ejemplo n.º 12
0
from app_config import app
import controller
from flask import render_template

app.register_blueprint(controller.admin_bp, url_prefix='/admin')
app.register_blueprint(controller.adv_bp, url_prefix='/adv')
app.register_blueprint(controller.driver_bp, url_prefix='/driver')


@app.route('/')
def index():
    return render_template('index.html')


if __name__ == '__main__':
    app.run(debug=True)
Ejemplo n.º 13
0
from app_config import app, port
from controller import blue_prints

for bp in blue_prints:
    app.register_blueprint(bp[0], url_prefix=bp[1])


@app.route('/')
def hello_world():
    return 'Hello World!'


if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True, port=port)
Ejemplo n.º 14
0
from app_config import app, db, csrf
from flask import render_template, request, redirect, url_for, make_response
from forms.register import RegisterForm


@app.route('/')
def home():
    return render_template('home.html')


@app.route('/register', methods=['GET', 'POST'])
def register():
    form = RegisterForm(request.form)
    if form.validate_on_submit():
        return redirect(url_for('home'))
    if request.method == 'POST':
        pass
    return render_template('user_related/register.html', form=form)


if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8080)
Ejemplo n.º 15
0
from app_config import app

if __name__ == '__main__':
    app.run(debug=False)