Exemplo n.º 1
0
def run_server():
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
Exemplo n.º 2
0
def profile(length=25, profile_dir=None):
    """Start the application under the code profiler."""
    from werkzeug.contrib.profiler import ProfilerMiddleware

    app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length],
                                      profile_dir=profile_dir)
    app.run()
Exemplo n.º 3
0
def startApp():
    """
    starts the flask app
    :return:
    :rtype:
    """
    app.debug = DEBUG
    app.run(host=HOST, port=LOCAL_PORT_NUMBER, threaded=True)
Exemplo n.º 4
0
def debug_server(config='dev', host='0.0.0.0', port=5000, **options):
    """调试运行 Web API Service

    @=config, c
    @=host, h
    @=port, p
    """
    app = _prepare_flask_app(config)
    port = int(port)
    app.run(host=host, port=port, debug=True)
Exemplo n.º 5
0
def debug_server(config='dev', host='0.0.0.0', port=5000, **options):
    """调试运行 Web API Service

    @=config, c
    @=host, h
    @=port, p
    """
    app = _prepare_flask_app(config)
    port = int(port)
    app.run(host=host, port=port, debug=True)
def run():
    """
    Run a local server
    """
    config.load_environment(app)
    settings_loaded = config.load_settings(app)
    if settings_loaded:
        app.run(host="0.0.0.0", port=os.getenv("PORT", "8000"))
    else:
        green_char = "\033[92m"
        end_charac = "\033[0m"
        print("-" * 35)
        print("Please run: {}eval $(gds aws XXXX -e){}".format(
            green_char, end_charac))
        print("Where {}XXXX{} is the account to access".format(
            green_char, end_charac))
        print("Then run make again")
        print("-" * 35)
        exit()
Exemplo n.º 7
0
def main():
    global port

    try:
        opt, args = getopt.getopt(sys.argv[1:], 'p:')
    except getopt.GetoptError as err:
        print('[-] %s' % err)
        exit(0)
        return

    for name, value in opt:
        if name == '-p':
            port = int(value)

    ipaddress = sock.gethostbyname(sock.gethostname())
    webhost = 'http://{}:{}'.format(ipaddress, port)
    print(' * ECS Remote Management Server')
    print('   云服务器远程管理服务端')
    print(' * 本机IP地址为: {}'.format(ipaddress))
    print('   web站点地址为 ' + webhost)
    webbrowser.open('http://127.0.0.1:{}'.format(port))
    app.run(host="0.0.0.0", port=port)
Exemplo n.º 8
0
from main import app

if __name__ == "__main__":
    app.run(host="0.0.0.0")
Exemplo n.º 9
0
from main import app

import logging

if __name__ == '__main__':
    logging.getLogger("gs-scroller").setLevel(logging.DEBUG)
    logging.getLogger("gs-scroller").addHandler(logging.StreamHandler())
    app.run(host='127.0.0.1', port=8080, debug=True)

Exemplo n.º 10
0
from main import app

app.run(host='127.0.0.1', port='8000', debug=True)
Exemplo n.º 11
0
__author__ = 'Will Crawford <*****@*****.**>'
from main import app

if __name__ == '__main__':
    if app.config['DEBUG']:
        use_debugger = True
        from database import init_db

        init_db()
    if app.config['DEBUG_WITH_PYCHARM']:
        use_debugger = not (app.config.get('DEBUG_WITH_PYCHARM'))
    app.run(use_debugger=use_debugger, port=1234)
    
Exemplo n.º 12
0
#!/usr/bin/env python
from main import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=8080, debug=True)
Exemplo n.º 13
0
def main():
    app.run()
Exemplo n.º 14
0
        Shop.status == 'DRAFT').count()
    processing_orders_count = db_session.query(Shop).filter(
        Shop.status == 'DRAFT').count()
    if processing_orders_count is not 0:
        processing_orders_arr = db_session.query(Shop).filter(
            Shop.status == 'DRAFT').all()
        max_processing_time = max([
            datetime.datetime.now(pytz.utc) -
            server_timezone.localize(order.created).astimezone(pytz.utc)
            for order in processing_orders_arr
        ])
        max_processing_time_in_seconds = max_processing_time.seconds
    return jsonify({
        'confirmed_orders_amount':
        confirmed_orders_amount,
        'unconfirmed_orders_amount':
        unconfirmed_orders_amount,
        'max_processing_time_in_seconds':
        max_processing_time_in_seconds
    })


@app.route('/robots.txt')
def static_from_root():
    return send_from_directory(app.static_folder, request.path[1:])


if __name__ == "__main__":
    port = int(os.environ.get('PORT', default_port))
    app.run(host='0.0.0.0', port=port)
Exemplo n.º 15
0
from main import app

app.run(host="0.0.0.0", debug=True)
Exemplo n.º 16
0
import os
from main import app, db

print app.__dict__
if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5000))
    app.run(host="0.0.0.0", port=port, debug=True)
    print app.routes
Exemplo n.º 17
0
def server(host='0.0.0.0', port=None, **kwargs):
    """[-host HOST] [-port PORT]
    Runs the application on the local development server.
    """
    app.run(host, port, **kwargs)
Exemplo n.º 18
0
#!/usr/bin/env python

if __name__ == "__main__":
    from main import app
    app.run(debug=True, host="0.0.0.0", port=1337)

import os

from flask import Flask

from osuchan.blueprint import osuchan
from osuchan.models import db

wd = os.getcwd()

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///%s/test.db" % wd
app.config["SQLALCHEMY_ECHO"] = True
app.config["SECRET_KEY"] = os.urandom(16)
db.init_app(app)
app.register_blueprint(osuchan)
Exemplo n.º 19
0
def _run_app(debug=False):
    app.debug = debug
    signal.signal(signal.SIGINT, _teardown)
    port = int(os.environ.get("PORT", 5000))
    app.run(host="0.0.0.0", port=port, use_reloader=False, threaded=True)
Exemplo n.º 20
0
from main import app

if __name__ == '__main__':
	app.run(debug=True, host='0.0.0.0', port=3338)
Exemplo n.º 21
0
from main import app

if __name__ == "__main__":
    app.run(port=5000, host="0.0.0.0", use_reloader=False)
Exemplo n.º 22
0
from main import app as application

if __name__ == "__main__":
	application.run()
Exemplo n.º 23
0
from main import app

app.debug = True

app.run(port=5001)
Exemplo n.º 24
0
from main import app


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8090)
Exemplo n.º 25
0
import os.path
import argparse

from main import app

SERVER_NAME = "%s:%d"

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Welcome to Planet Shenely!")
    
    parser.add_argument("-d", "--debug", action="store_true",
                        help="enable or disable debug mode")
    parser.add_argument("-f", "--file", type=str,
                        default=os.path.join(os.path.dirname(__file__),
                                             "data.json"),
                        help="the file to store data")
    parser.add_argument("-o", "--host", type=str, default="localhost",
                        help="the hostname to listen on")
    parser.add_argument("-p","--port", type=int, default=8080,
                        help="the port of the webserver")
    
    args = vars(parser.parse_args())
    
    app.config["SERVER_NAME"] = SERVER_NAME % (args["host"], args["port"])
    app.config["DATABASE"] = args["file"]

    app.run(debug=args["debug"])
Exemplo n.º 26
0
import sys

reload(sys)
sys.setdefaultencoding('utf-8')
sys.dont_write_bytecode = True

class Unbuffered(object):
  def __init__(self, stream):
    self.stream = stream
  def write(self, data):
    self.stream.write(data)
    self.stream.flush()
  def __getattr__(self, attr):
    return getattr(self.stream, attr)

sys.stdout = Unbuffered(sys.stdout)

sys.path.insert(0, sys.path[0] + '/' + 'app')

from main import app
import websiteconfig

if __name__ == "__main__":
  app.config.from_object(websiteconfig.TestingConfig)
  app.run(
    host=app.config['ADDR'],
    port=app.config['PORT'],
    threaded=True
  )

Exemplo n.º 27
0
from main import app, config

if __name__ == '__main__':
    host = config.get('host')
    port = int(config.get('port'))
    app.run(debug=False, host=host, port=port)
Exemplo n.º 28
0
from main import app
"""
uwsgi.ini 파일
chdir=./
wsgi-file=./run.py(flask 앱 진입점)
callable=app
"""

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
Exemplo n.º 29
0
from main import app

app.run(host="0.0.0.0", port=8080, debug=True)
Exemplo n.º 30
0
def server(host='0.0.0.0', port=None, **kwargs):
    """[-host HOST] [-port PORT]
    Runs the application on the local development server.
    """
    app.run(host, port, **kwargs)
Exemplo n.º 31
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import getopt

from main import app
from views import oauth, card, weixin, index, mycard
from db import db_conn

try:
    from bae.core.wsgi import WSGIApplication
    application = WSGIApplication(app)
except:
    port = 8080
    app.run(host="0.0.0.0", port=port)
Exemplo n.º 32
0
from main import app

if __name__ == '__main__':
    app.run(debug=True, use_reloader=True)
Exemplo n.º 33
0
from main import app
app.run(host='0.0.0.0', port=8888, debug=True)
Exemplo n.º 34
0
from main import app

if __name__ == '__main__':
    app.run(debug=True, port=80, host="0.0.0.0", threaded=True)
Exemplo n.º 35
0
import os
from main import app
import settings


if __name__ == '__main__':
    app.debug = True
    app.config['SECRET_KEY'] = "kljasdno9asud89uy981uoaisjdoiajsdm89uas980d"
    app.config['DATABASE'] = (0, settings.DATABASE_NAME)

    host = os.environ.get('IP', '0.0.0.0')
    port = int(os.environ.get('PORT', 8080))
    app.run(host=host, port=port)
Exemplo n.º 36
0
from main import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)
Exemplo n.º 37
0
#!/usr/bin/env python
import os
import sys
import json
from main import app


if __name__ == "__main__":
    conf = {}
    conf["SECRET_KEY"] = "CHANGEME"
    conf["DEBUG"] = True

    app.config.update(conf)
    # app.static_folder = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static')
    app.run(host="0.0.0.0")
Exemplo n.º 38
0
#!venv/bin/python
from main import app

if __name__ == "__main__":
	app.run(host='0.0.0.0', debug=True, port=80)
Exemplo n.º 39
0
new_person_id = add_person(fake_4)
add_symptoms(fake_4, new_person_id)
print('created fake 4')

home_5 = Address("3368 Willison Street", '', 'MN', 'Minneapolis', "55415")

fake_5 = Person('Betty', 'Primmer', 42, '7632382303',
                '*****@*****.**', home_1)
fake_5.add_work('AWS', '9185584730', '*****@*****.**', work_add_1)
fake_5.add_symptoms({
    'cough': True,
    'fever': True,
    'how_hot': 100,
    'fatigue': True,
    'difficulty_breathing': True,
    'how_difficult': 7,
    'runny_nose': False,
    'body_aches': False,
    'headache': False,
    'stomach': False,
    'sore_throat': True,
    'how_long': 6
})

new_person_id = add_person(fake_5)
add_symptoms(fake_5, new_person_id)
print('created fake 5')

if __name__ == '__main__':
    app.run(debug=False)
Exemplo n.º 40
0
#     if request.method =="POST":
#         file = request.files.get("picture")
#         print([ i for i in dir(file) if not i.startswith("_")])
#     return render_template("picture.html")
#
#
#
#
#
# if __name__ == "__main__":
#     app.run(host="127.0.0.1" ,port=8000 ,debug=True)  # 启动这个应用

from flask import Flask
from flask import render_template

app = Flask(__name__)  #创建一个应运


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


@app.route("/content/<username>/<int:age>/")
def content(username, age):
    return "heelo,i am %s %s old" % (username, age)


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8000, debug=True)  #启动应运
Exemplo n.º 41
0
from main import app

if __name__ == "__main__":
	app.run(host='0.0.0.0')
Exemplo n.º 42
0
from main.utils import init_wechat_instance
from main.response import handle_response
from flask import request, make_response, redirect


@app.route('/', methods = ['GET', 'POST'])
def wechat_auth():

    signature = request.args.get('signature')
    timestamp = request.args.get('timestamp')
    nonce = request.args.get('nonce')

    wechat = init_wechat_instance()
    if not wechat.check_signature(
        signature=signature, timestamp=timestamp, nonce=nonce):
        if request.method == 'POST':
            return "signature failed"
        else:
            return redirect(app.config['MAIN_URL'])

    if request.method == 'POST':
        return handle_response(request.data)
    else:
        # 微信接入验证
        return make_response(request.args.get('echostr', ''))

if __name__ == '__main__':
    app.debug = app.config['DEBUG']
    app.run(port=8000)
Exemplo n.º 43
0
from werkzeug.middleware.profiler import ProfilerMiddleware
from main import app

app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[15])
app.run(host='0.0.0.0', port=12100, debug=True)
Exemplo n.º 44
0
# coding: utf-8

import sys
from main import app

if __name__ == '__main__':
    debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
    app.run(host='0.0.0.0', debug=debug)
Exemplo n.º 45
0
from os.path import join
from main import app
from flask import send_from_directory, Blueprint, send_file
import os

print "Starting webapp!"

# user sub-app
from user.views import user
app.register_blueprint(user, url_prefix='/user')

# splash
from splash.views import splash
app.register_blueprint(splash)

# editor
from editor.views import editor
app.register_blueprint(editor, url_prefix='/editor')

# modules manage their own static files. This serves them all up.
@app.route("/<blueprint_name>/static/<path:fn>")
def _return_static(blueprint_name, fn='index.html'):
    path = join(*app.blueprints[blueprint_name].import_name.split('.')[:-1]) 
    return send_file('%s/static/%s' % (path, fn)) 


port = os.getenv('VCAP_APP_PORT', '5000')
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=int(port))
Exemplo n.º 46
0
from main import app
app.run(host='localhost')
Exemplo n.º 47
0
from main import app, db
from models import BlogPost, Project, User
from helpers import *
from views import *

if __name__ == '__main__':
    db.connect()
    db.create_tables([BlogPost, Project, User], safe=True)
    app.run(debug=True,host="127.0.0.1")
Exemplo n.º 48
0
from main import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=False, port=9000)
Exemplo n.º 49
0
from main import app

from views import *
app.run(host='0.0.0.0', debug=True)
Exemplo n.º 50
0
from werkzeug.contrib.profiler import ProfilerMiddleware
from main import app

app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
app.run(debug=True)
Exemplo n.º 51
0
#!/usr/bin/env python

from main import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8000)
Exemplo n.º 52
0
"""
URL routing & initialization for webapp
"""

from os.path import join
from main import app
from flask import send_from_directory, Blueprint, send_file

print "Starting webapp!"
# splash
from splash.views import splash

app.register_blueprint(splash)


# modules manage their own static files. This serves them all up.
@app.route("/<blueprint_name>/static/<path:fn>")
def _return_static(blueprint_name, fn='index.html'):
    path = join(*app.blueprints[blueprint_name].import_name.split('.')[:-1])
    return send_file('%s/static/%s' % (path, fn))


if __name__ == '__main__':
    app.run(debug=True)
Exemplo n.º 53
0
from main import app

app.run(port=8081, debug=True)
Exemplo n.º 54
0
from main import app, IP

if __name__ == "__main__":
    app.run(host=IP, port=8443, use_reloader=True,
            debug=True, ssl_context=('webhook_cert.pem', 'webhook_pkey.pem'))
Exemplo n.º 55
0
Arquivo: run.py Projeto: amachefe/Um
#!/usr/bin/env python

from main import app
app.run(debug=False)
Exemplo n.º 56
0
from main import app

if __name__ == '__main__':
    app.run()
Exemplo n.º 57
0
def runserver():
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Exemplo n.º 58
0
#Invoke this with "gunicorn --bind 127.0.0.1:5000 wsgi" or "./run.sh"

#Import as application becuase gunicorn complains otherwise
from main import app as application

#Run it
if __name__ == "__main__":
    application.run()
Exemplo n.º 59
0
from main import app

if __name__ == '__main__':
    app.run(port=81, host='0.0.0.0')