コード例 #1
0
def run(generate_pks, show_pks, host, port, uri):
    """Connect sandman to <URI> and start the API server/admin
    interface."""
    app.config['SQLALCHEMY_DATABASE_URI'] = uri
    app.config['SANDMAN_GENERATE_PKS'] = generate_pks
    app.config['SANDMAN_SHOW_PKS'] = show_pks
    app.config['SERVER_HOST'] = host
    app.config['SERVER_PORT'] = port
    activate(name='sandmanctl')
    app.run(host=host, port=int(port), debug=True)
コード例 #2
0
ファイル: sandmanctl.py プロジェクト: Jingcui01/campusTours
def run(generate_pks, show_pks, host, port, uri):
    """Connect sandman to <URI> and start the API server/admin
    interface."""
    app.config['SQLALCHEMY_DATABASE_URI'] = uri
    app.config['SANDMAN_GENERATE_PKS'] = generate_pks
    app.config['SANDMAN_SHOW_PKS'] = show_pks
    app.config['SERVER_HOST'] = host
    app.config['SERVER_PORT'] = port
    activate(name='sandmanctl')
    app.run(host=host, port=int(port), debug=True)
コード例 #3
0
ファイル: sandmanctl.py プロジェクト: zhonglaowu/sandman
def main(test_options=None):
    """Main entry point for script."""
    options = test_options or docopt(__doc__)
    URI = options['URI']
    app.config['SQLALCHEMY_DATABASE_URI'] = options['URI']
    app.config['SANDMAN_GENERATE_PKS'] = options['--generate-pks'] or False
    app.config['SANDMAN_SHOW_PKS'] = options['--show-pks'] or False
    host = options.get('--host') or '0.0.0.0'
    port = options.get('--port') or 5000
    app.config['SERVER_HOST'] = host
    app.config['SERVER_PORT'] = port
    activate(name='sandmanctl')
    app.run(host=host, port=int(port), debug=True)
コード例 #4
0
ファイル: sandmanctl.py プロジェクト: 521xueweihan/sandman
def main(test_options=None):
    """Main entry point for script."""
    options = test_options or docopt(__doc__)
    URI = options['URI']
    app.config['SQLALCHEMY_DATABASE_URI'] = options['URI']
    app.config['SANDMAN_GENERATE_PKS'] = options['--generate-pks'] or False
    app.config['SANDMAN_SHOW_PKS'] = options['--show-pks'] or False
    host = options.get('--host') or '0.0.0.0'
    port = options.get('--port') or 5000
    app.config['SERVER_HOST'] = host
    app.config['SERVER_PORT'] = port
    activate(name='sandmanctl')
    app.run(host=host, port=int(port), debug=True)
コード例 #5
0
ファイル: sandmanctl.py プロジェクト: akshaynathr/todo
def main(test_options=None):
    """Main entry point for script."""
    import pkg_resources
    version = None
    try:
        version = pkg_resources.get_distribution('sandman').version
    finally:
        del pkg_resources

    options = test_options or docopt(__doc__, version=version)
    URI = options['URI']
    app.config['SQLALCHEMY_DATABASE_URI'] = options['URI']
    app.config['SANDMAN_GENERATE_PKS'] = options['--generate-pks'] or False
    app.config['SANDMAN_SHOW_PKS'] = options['--show-pks'] or False
    host = options.get('--host') or '0.0.0.0'
    port = options.get('--port') or 5000
    app.config['SERVER_HOST'] = host
    app.config['SERVER_PORT'] = port
    activate(name='sandmanctl')
    app.run(host=host, port=int(port), debug=True)
コード例 #6
0
ファイル: ServerCommand.py プロジェクト: sohiljain/client
    def do_server(self, args, arguments):
        """
        Usage:
            server

        Options:
          -h --help
          -v       verbose mode

        Description:
          Starts up a REST service and a WEB GUI so one can browse the data in an
          existing cloudmesh database.

          The location of the database is supposed to be in

            ~/.cloud,esh/cloudmesh.db

        """

        # import warnings
        # with warnings.catch_warnings():
        #    warnings.filter("ignore")
        # ignore "SQLALCHEMY_TRACK_MODIFICATIONS")

        from sandman import app
        from sandman.model import activate

        filename = "sqlite:///{}".format(
            Config.path_expand(os.path.join("~", ".cloudmesh",
                                            "cloudmesh.db")))

        print("database: {}".format(filename))

        app.config['SQLALCHEMY_DATABASE_URI'] = filename
        app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

        activate()

        app.run()
コード例 #7
0
ファイル: ServerCommand.py プロジェクト: alistairking/client
    def do_server(self, args, arguments):
        """
        Usage:
            server

        Options:
          -h --help
          -v       verbose mode

        Description:
          Starts up a REST service and a WEB GUI so one can browse the data in an
          existing cloudmesh database.

          The location of the database is supposed to be in

            ~/.cloud,esh/cloudmesh.db

        """

        # import warnings
        # with warnings.catch_warnings():
        #    warnings.filter("ignore")
        # ignore "SQLALCHEMY_TRACK_MODIFICATIONS")

        from sandman import app
        from sandman.model import activate

        filename = "sqlite:///{}".format(Config.path_expand(
            os.path.join("~", ".cloudmesh", "cloudmesh.db")))

        print("database: {}".format(filename))

        app.config['SQLALCHEMY_DATABASE_URI'] = filename
        app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

        activate()

        app.run()
コード例 #8
0
#         #return redirect(url_for('uploaded_file', filename=filename))
#         return("Upload Success!")
#
# @app.route('/uploads/<filename>')
# def uploaded_file(filename):
#     return send_from_directory(app.config['UPLOAD_FOLDER'],
#                                filename)
#
# remove all records
@app.route('/remove_all', methods=['GET', 'POST'])
def remove_all():
    connection = None
    try:
        cursor = db_methods.getCursor(connection, db_name, user_name,
                                      host_name, password)
        db_methods.clearDatabase(cursor)
        return render_template('index.html')
    except psycopg2.DatabaseError as e:
        return render_template('error.html', msg=e)
    finally:
        if connection:
            connection.close()


if __name__ == '__main__':
    app.run(host="127.0.0.1",
            port=int("5000"),
            debug=True,
            threaded=True,
            ssl_context=context)
コード例 #9
0
ファイル: tsand.py プロジェクト: axuaxu/montreal
from sandman import app, db
from sandman.model import activate
app.config['SQLALCHEMY_DATABASE_URI'] = 'monreal.sqlite'

from sandman.model import register, Model

#class Artist(Model):
#    __tablename__ = 'Artist'

#class Album(Model):
#    __tablename__ = 'Album'

#class Playlist(Model):
#    __tablename__ = 'Playlist'

#register((Artist, Album, Playlist))


class monrent(Model):
    __tablename__ = 'monrent'


class plinks(Model):
    __tablename__ = 'plinks'


register((monrent, plinks))
sandman.model.activate_admin_classes
app.run()
コード例 #10
0
ファイル: runserver.py プロジェクト: AndrewJHart/sandman
"""Run server"""
from sandman import app, db
import os
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + os.path.abspath(os.path.dirname(__file__)) + '/chinook'
app.secret_key = 's3cr3t'
import models
app.run(debug=True)
コード例 #11
0
"""Run server"""
from sandman import app, db
import os
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + os.path.abspath(
    os.path.dirname(__file__)) + '/chinook'
import models
app.run(debug=True)
コード例 #12
0
ファイル: runserver.py プロジェクト: HengeSense/sandman
"""Run server"""
from sandman import app, db
import os
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + os.path.abspath(os.path.dirname(__file__)) + '/chinook'
app.secret_key = 's3cr3t'
import models
app.run(host='0.0.0.0', debug=True)
コード例 #13
0
"""Run server"""
from sandman import app, db
import os

app.config[
    'SQLALCHEMY_DATABASE_URI'] = 'sqlite+pysqlite:///tests/data/chinook.sqlite3'
app.secret_key = 's3cr3t'
import models

app.run(host='0.0.0.0', debug=True)
コード例 #14
0
ファイル: api_rest.py プロジェクト: arruda/sandman_example
APP_PATH = os.path.dirname(os.path.abspath(__file__))
DB_PATH = os.path.join(APP_PATH, 'db.sqlite')

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + DB_PATH


from sandman.model import register, activate, Model


class Poll(Model):
    __tablename__ = 'poll_poll'


class Vote(Model):
    __tablename__ = 'poll_vote'


class Item(Model):
    __tablename__ = 'poll_item'


class User(Model):
    __tablename__ = 'auth_user'

# # register can be called with an iterable or a single class
register((Poll, Vote, Item, User))

activate(browser=False)

app.run()
コード例 #15
0
                elif action.action_type == 'DELETE':
                    # when action_type is DELETE, the action value tells you the ID of the row to delete in the 1-to-many or many-to-many table
                    cls_instance = cls.query.get(action.value)
                    db.session.delete(cls_instance)
                elif action.action_type == 'UPDATE':
                    db.session.rollback()
                    raise ValueError(
                        "Support for updating values hasn't been implemented yet."
                        +
                        "Either implement updating in the code, or do a delete followed by an insert."
                    )
                else:
                    db.session.rollback()
                    raise ValueError("Invalid action type = " +
                                     action.action_type)
            else:
                db.session.rollback()
                raise ValueError("Invalid property name = " + action.property)

        db.session.commit()
        #time.sleep(30)


delete_plants()
process_transactions()

print('ACTIVATE')
activate(browser=True)
print('RUN')
app.run(debug=False)
コード例 #16
0
ファイル: sandman_run.py プロジェクト: berz/lossebladjes
#!venv/bin/python
from sandman import app
from sandman.model import activate

app.config.from_object('config')

activate()

app.run(host='0.0.0.0', port=5001)