Beispiel #1
0
def run(local: bool):
    if local:
        app.debug = True
        # app.run(host='0.0.0.0', threaded=True)
        app.run(host='0.0.0.0')
    else:
        run_container()
Beispiel #2
0
def main():
    """ Load up the web app and the core ABLS service.
	"""
    print("Starting the ABLS instance")
    startABLS(True)  # Start the service in the background (startAll set to true)
    print("Starting the front-end web app")
    app.run(debug=True)
Beispiel #3
0
def run(host='0.0.0.0', port=None):
    """Runs the application on the local development server.
    """
    from webapp.app import app
    try:
        port = int(port) if port else None
    except (ValueError, TypeError):
        port = None
    app.run(host, port)
Beispiel #4
0
import os
from os.path import join, dirname
from dotenv import load_dotenv

dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
os.environ["DEBUG"] = "True"

from webapp.app import app
app.run(debug=True)
Beispiel #5
0
import os
import sys

if __name__ == '__main__':

    # Validate arguments and show help if failed
    try:
        int(sys.argv[1])
    except:
        print("Usage: python3 run_node.py [node id, 1-4]")
        exit(1)

    node_id = int(sys.argv[1].strip())
    receiving_port = 5000 + node_id
    if node_id != "0":
        import config
        # store node-specific values in config; should probably move these to a node class
        config.DB_PATH = "database" + os.sep + str(
            node_id) + os.sep + "node.db"
        config.node_id = node_id
        config.receiving_port = receiving_port
        del config.PEERS[node_id]

    from webapp.app import app
    app.run(port=config.receiving_port, debug=True)
from webapp.app import app
import webapp.settings as settings
app.run(debug=settings.DEBUG)

Beispiel #7
0
def wait_for_postgres():
    try:
        db.engine.execute("SELECT 1")
        print("connected to db")
        return None
    except Exception as e:
        print("Error while trying to connect to the DB: {}".format(e))
        time.sleep(2)
        wait_for_postgres()


def create_items():
    """Create all inquiries in the DB if non-existent."""
    if not any(Inquiry.query.all()):
        print("Creating Initial Sample Questions...")
        sample_q = "Sample Question?"
        sample_ans = "Sample Answer."
        for _ in range(MAX_INQUIRIES):
            new_inquiry = Inquiry(sample_q, sample_ans)
            db.session.add(new_inquiry)
    db.session.commit()


wait_for_postgres()
db.create_all()
create_items()

if __name__ == '__main__':
    app.run(host='0.0.0.0')
Beispiel #8
0
# pip install flask
# root directory "webapp"
# new directory "app"
# in "app" new directory "static" and "templates"

# in "webapp" create run.py 
# in "app" create __init__.py and views.py

# in "__init__.py"
from flask inmport Flask
app = Flask(__name__)
from webapp.app import views

# in "run.py"
from webapp.app import app
app.run(debug= true)

# in "views.py"
from webapp.app import app
from flask import request, url_for, redirect, render_template
@app.route('/')
@app.route('/index')
def index():
  
  return "hello, world"
 
@app.route('/profile/username')
def profile(username):
  #return "hello,{}".format(username)
  return render_template(url_for,username = username)
# if 127.0.0.1:5000/profile/abc => print hello, abc
from webapp.app import app
app.run(debug=True)  # set debug=False when running on production
Beispiel #10
0
def web_server():
	app.run()
Beispiel #11
0
#!/bin/bash/python

from webapp.app import app

if __name__ == '__main__':
    app.run(use_reloader=True)
Beispiel #12
0
import os
from os.path import join, dirname
from dotenv import load_dotenv

dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
os.environ["DEBUG"] = "True"

from webapp.app import app

app.run(host='0.0.0.0', port=8000, debug=True)
Beispiel #13
0
from webapp.app import app

app.run('localhost', 5001, debug=True)

Beispiel #14
0
if __name__ == '__main__':
    from webapp.app import app
    app.run(port=5000, debug=True)

Beispiel #15
0
from webapp.app import app as application

if __name__ == "__main__":
    application.run()
Beispiel #16
0
def runserver(config, host, port):
    app.run(host=host, port=port, debug=True)
Beispiel #17
0
#! /usr/bin/env python
"""
Script to run the malgudi webapp using development web server.

Usage:

    export FLASK_DEBUG=1
    python run.py

The database migrations are automatically run on startup. To run only the db
migrations, use:

    python run.py --migrate
"""
import sys
from webapp.app import app
from webapp.migrate import migrate

if __name__ == "__main__":
    if "--migrate" in sys.argv:
        migrate()
    else:
        migrate()
        app.run()