コード例 #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)
コード例 #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()
コード例 #3
0
ファイル: host.py プロジェクト: DandDevy/medi_ai
def startApp():
    """
    starts the flask app
    :return:
    :rtype:
    """
    app.debug = DEBUG
    app.run(host=HOST, port=LOCAL_PORT_NUMBER, threaded=True)
コード例 #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)
コード例 #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)
コード例 #6
0
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()
コード例 #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)
コード例 #8
0
from main import app

if __name__ == "__main__":
    app.run(host="0.0.0.0")
コード例 #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)

コード例 #10
0
from main import app

app.run(host='127.0.0.1', port='8000', debug=True)
コード例 #11
0
ファイル: runserver.py プロジェクト: sapid/Flask-Community
__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)
    
コード例 #12
0
#!/usr/bin/env python
from main import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', port=8080, debug=True)
コード例 #13
0
def main():
    app.run()
コード例 #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)
コード例 #15
0
ファイル: run.py プロジェクト: bsyouness/PunORama
from main import app

app.run(host="0.0.0.0", debug=True)
コード例 #16
0
ファイル: run.py プロジェクト: kracekumar/digfont
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
コード例 #17
0
ファイル: manage.py プロジェクト: lucuma/Shake
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)
コード例 #18
0
ファイル: main.py プロジェクト: MostAwesomeDude/osuchan2
#!/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)
コード例 #19
0
ファイル: run.py プロジェクト: jkaberg/jarvis2
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)
コード例 #20
0
ファイル: dev_server.py プロジェクト: falcondai/viz-demo
from main import app

if __name__ == '__main__':
	app.run(debug=True, host='0.0.0.0', port=3338)
コード例 #21
0
from main import app

if __name__ == "__main__":
    app.run(port=5000, host="0.0.0.0", use_reloader=False)
コード例 #22
0
ファイル: wsgi.py プロジェクト: willdeberry/recipes
from main import app as application

if __name__ == "__main__":
	application.run()
コード例 #23
0
from main import app

app.debug = True

app.run(port=5001)
コード例 #24
0
from main import app


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8090)
コード例 #25
0
ファイル: __main__.py プロジェクト: shenely/planet_shenely
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"])
コード例 #26
0
ファイル: test_run.py プロジェクト: luff/nsca-web-config
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
  )

コード例 #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)
コード例 #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)
コード例 #29
0
ファイル: debug.py プロジェクト: hupili/hk_census_explorer
from main import app

app.run(host="0.0.0.0", port=8080, debug=True)
コード例 #30
0
ファイル: manage.py プロジェクト: lucuma/Shake
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)
コード例 #31
0
ファイル: server.py プロジェクト: nasta/cards
#!/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)
コード例 #32
0
from main import app

if __name__ == '__main__':
    app.run(debug=True, use_reloader=True)
コード例 #33
0
ファイル: run.py プロジェクト: andimiller/timerboard
from main import app
app.run(host='0.0.0.0', port=8888, debug=True)
コード例 #34
0
ファイル: run.py プロジェクト: amana632/backend
from main import app

if __name__ == '__main__':
    app.run(debug=True, port=80, host="0.0.0.0", threaded=True)
コード例 #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)
コード例 #36
0
from main import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)
コード例 #37
0
ファイル: testserver.py プロジェクト: nullism/dungeonsheet
#!/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")
コード例 #38
0
ファイル: run.py プロジェクト: theAcer/investengine
#!venv/bin/python
from main import app

if __name__ == "__main__":
	app.run(host='0.0.0.0', debug=True, port=80)
コード例 #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)
コード例 #40
0
ファイル: views.py プロジェクト: dasdasda21/flask
#     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)  #启动应运
コード例 #41
0
ファイル: wsgi.py プロジェクト: quake0day/Dodrio
from main import app

if __name__ == "__main__":
	app.run(host='0.0.0.0')
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #45
0
ファイル: webstart.py プロジェクト: mrosales/pennapps-f14
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))
コード例 #46
0
ファイル: local_web.py プロジェクト: EntropyT/void-battery
from main import app
app.run(host='localhost')
コード例 #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")
コード例 #48
0
from main import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=False, port=9000)
コード例 #49
0
ファイル: run.py プロジェクト: drakipovic/Penguin
from main import app

from views import *
app.run(host='0.0.0.0', debug=True)
コード例 #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)
コード例 #51
0
#!/usr/bin/env python

from main import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8000)
コード例 #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)
コード例 #53
0
ファイル: run.py プロジェクト: esiegel/jesse_prank
from main import app

app.run(port=8081, debug=True)
コード例 #54
0
ファイル: wsgi.py プロジェクト: zYoma/news_parser
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'))
コード例 #55
0
ファイル: run.py プロジェクト: amachefe/Um
#!/usr/bin/env python

from main import app
app.run(debug=False)
コード例 #56
0
from main import app

if __name__ == '__main__':
    app.run()
コード例 #57
0
ファイル: runserver.py プロジェクト: tiantianquan/InOutApp
def runserver():
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
コード例 #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()
コード例 #59
0
ファイル: voucher.py プロジェクト: tester-dark/vales
from main import app

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