def runserver(): app.config.from_object(BaseConfig) app.run(debug=True)
from tracker import app app.run(debug=True, host='0.0.0.0', port=5001)
from tracker import app app.run(host='0.0.0.0', port=5000, debug=True)
def edit_variant_property(variant_id, key, old_value, new_value, username): property = Property.query.filter(Property.variant_id == variant_id).filter( Property.key == key).filter(Property.value == old_value).first() property.value = new_value db.session.commit() variant = Variant.query.filter_by(id=variant_id).first() item = Item.query.filter_by(id=variant.item_id).first() activity = Activity(1, username, item.name, variant.name, property.key) db.session.add(activity) db.session.commit() return jsonify(Message='Property modified successfully') @app.route('/variant/<variant_id>/property/<key>/<value>/<username>', methods=['DELETE']) def delete_variant_property(variant_id, key, value, username): property = Property.query.filter(Property.variant_id == variant_id).filter( Property.key == key).filter(Property.value == value).first() db.session.delete(property) db.session.commit() variant = Variant.query.filter_by(id=variant_id).first() item = Item.query.filter_by(id=variant.item_id).first() activity = Activity(2, username, item.name, variant.name, property.key) db.session.add(activity) db.session.commit() return jsonify(Message='Property removed successfully') if __name__ == '__main__': app.run()
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from tracker import app if __name__ == "__main__": port = int(os.environ.get("PORT", 5000)) app.run(port=port)
from tracker import app if __name__ == '__main__': app.run(debug=True)
from threading import Thread from agents_broker import sync from tracker import app thread = Thread(target=sync) thread.start() app.run(debug=False, host='0.0.0.0', port='3000')
#!/usr/bin/env python from flask import Flask from tracker import app from tracker.cron import scheduler from tracker.models import init_db import os import sys if __name__ == '__main__': try: import config app.secret_key = config.secret_key except ImportError: app.secret_key = os.urandom(24) base_dir = os.path.dirname(os.path.realpath(__file__)) app.debug = True app.config['version'] = '2.0' app.config['UPLOAD_FOLDER'] = os.path.join(base_dir, 'uploads/') app.config['REPOSITORY_FOLDER'] = os.path.join(base_dir, 'repositories/') app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' init_db() print('Database initialized.') scheduler.start() port = 5000 if len(sys.argv) > 1: port = int(sys.argv[1]) app.run(host='0.0.0.0', port=port)
def main(): app.run()