예제 #1
0
    def __init__(self):
        dotenv_path = join(dirname(__file__), '.env')
        load_dotenv(dotenv_path)

        host = os.getenv('FLASK_HOST')
        port = int(os.getenv('FLASK_PORT'))
        debug = os.getenv('FLASK_DEBUG')

        app.run(host=host, port=port, debug=debug)
예제 #2
0
import json
from App import app, api, address
import User
import Event


serverAddress = "localhost"

if __name__ == '__main__':
  # server = json.load(open('config.json'))['flask']
  # User.app.run(debug=True,host=server['network'], port=int(server['port']))
  Event.getToken()
  app.run(debug=True,host=address, port=8000)
예제 #3
0
        getInfo = GetInfo(browser)
    elif zdhm == 'YZF':
        from yunzhangfang.NewViews import GetInfo
        getInfo = GetInfo(browser)

    # 登陆
    i = 1
    while True:
        msg = getInfo.login(login_info)
        if msg == '登陆成功':
            return msg
        elif msg == '登录失败':
            i += 1
            continue
        elif msg == '账号和密码不匹配,请重新输入':
            return msg
        elif msg == '账号已停用或合同未审核通过':
            return msg
        elif msg == '账号不存在或已停用':
            return msg
        elif i > 4:
            return '验证码错误%s次,需要人工介入' % i
        elif msg == '验证码错误,请重新输入':
            i += 1
            continue


if __name__ == '__main__':
    # app.run(host='0.0.0.0',debug=True,processes=4)
    app.run(host='0.0.0.0', port=5500, debug=False, threaded=False)
예제 #4
0
from App import app

app.run(host='192.168.2.8')
예제 #5
0
#!/anaconda3/bin/python3.7
# -*- coding: utf-8 -*-
# App.py
# Bernard Schroffenegger
# 20th of October, 2019

from App import app

HOST = 'localhost'
PORT = 5000
DEBUG = True

if __name__ == '__main__':

    app.run(debug=DEBUG, host=HOST, port=PORT)
예제 #6
0
from App import app

##########################
####### run server #######
##########################

if __name__ == "__main__":
    app.run()
예제 #7
0
#! /usr/bin/python

from App import app
import os

if __name__ == '__main__':
    port_ = int(os.getenv('FLASK_PORT', 5000))
    app.run(host='127.0.0.1', port=port_, debug=True)
예제 #8
0
from App import app
#import config

if __name__ == '__main__':
    app.run(host="0.0.0.0", port="8000")
예제 #9
0
from App import app

if __name__ == '__main__':
    app.run(
        host="127.0.0.1",
        port=5000,
        debug=True
    )
예제 #10
0
from App import app

app.run("127.0.0.1", 5000)
예제 #11
0
                        datefmt="%Y-b%-d %H:%M:%S")  # 调试debug级
    # logging.basicConfig()from flask_cache import make_template_fragment_key

    # 创建日志记录器,指明日志保存的路径、每个日志文件的最大大小、保存的日志文件个数上限
    # file_log_handler = logging.handlers.RotatingFileHandler(config.DY_DATAS_LOG_PATH, maxBytes=1024 * 1024 * 100, backupCount=100)
    # 每天一次日志
    file_log_handler = logging.handlers.TimedRotatingFileHandler(
        os.path.join(config.DY_DATAS_LOG_PATH, "running_log"), 'D', 1, 0)
    file_log_handler.suffix = "%Y%m%d-%H%M%S.log"
    # 创建日志记录的格式 日志等级 输入日志信息的文件名 行数 日志信息
    formatter = logging.Formatter(
        '%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(message)s')
    # 为刚创建的日志记录器设置日志记录格式
    file_log_handler.setFormatter(formatter)
    # 为全局的日志工具对象(flask app使用的)添加日志记录器
    logging.getLogger().addHandler(file_log_handler)

    app = create_app('App.config')

    return app


if __name__ == '__main__':

    app = new_app()

    app.run(debug=config.DEBUG,
            host=config.HOST,
            port=config.PORT,
            threaded=config.THREADED)
예제 #12
0
    elif lang == "3":
        file_name = "Main.java"
    else:
        error['msg'] = "error language option"
        return error
    with open(dist + file_name, "w", encoding="utf-8") as f:
        f.write(src)
        f.close()


@app.route("spj", methods=['POST'])
def get_spj():
    dist = request.form['dist']
    spj_src = request.form['spj']
    spj_lang = request.form['lang']
    if spj_lang == "1":
        file_name = "main.c"
    elif spj_lang == "2":
        file_name = "main.cpp"
    else:
        error['msg'] = "error language option"
        return error
    with open(dist + file_name, "w", encoding="utf-8") as f:
        f.write(spj_src)
        f.close()
    os.system(f"g++ {dist + file_name} -o SpecialJudge -O2")


if __name__ == "__main__":
    app.run(host="0.0.0.0")
예제 #13
0
"""
This script runs the LY_Flask application using a development server.
"""

from os import environ
from App import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5000'))
    except ValueError:
        PORT = 5000
    app.run(HOST, PORT)
예제 #14
0
파일: run.py 프로젝트: ADELA-TLS/Site
from App import app

if __name__ == "__main__":
    app.run(debug=True)
예제 #15
0
from App import app
import os
if __name__ == "__main__":
    # Fetch the environment variable (so it works on Heroku):
    app.run(host='0.0.0.0', port=int(os.environ.get("PORT", 5000)))
예제 #16
0
파일: wsgi.py 프로젝트: mmanumos/chronocar
from App import app
if __name__ == "__main__":
    app.run()
예제 #17
0
"""Run this file to test the app!"""

from App import app

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=80, debug=True)
    # app.run(host='127.0.0.1', port=80)
예제 #18
0
from flask import render_template
from App import app, db
from App.models import Block

#删除/创建数据库
# db.drop_all()
# db.create_all()


@app.route('/')
def index():
    blocks = Block.getBlocks()
    return render_template('index.html', blocks=blocks)


if __name__ == '__main__':
    app.run(port=8080, debug=True)
예제 #19
0
from App import app
import os
if __name__ == "__main__":
    # Fetch the environment variable (so it works on Heroku):
    app.run(port=int(os.environ.get("PORT", 5000)))
예제 #20
0
from App import app

if __name__ == "__main__":
    # Only for debugging while developing
    app.run(host='0.0.0.0', debug=True, port=5000)
예제 #21
0
from App import app, address, port
from models.db import db
import controller.Passport
import controller.Event
import controller.Vendor
import controller.User

from models.Event import *
from models.Passport import *
from models.User import *
from models.Permission import *
from models.Vendor import *

if __name__ == '__main__':
    db.create_all()

    admin.add_view(ModelView(Purchase, db.session))
    admin.add_view(ModelView(Product, db.session))
    admin.add_view(ModelView(Vendor, db.session))
    admin.add_view(ModelView(Event, db.session))
    admin.add_view(ModelView(Passport, db.session))
    admin.add_view(ModelView(Group, db.session))
    admin.add_view(ModelView(Permission, db.session))
    admin.add_view(ModelView(User, db.session))

    app.run(debug=True, host="0.0.0.0", port=int(port))
예제 #22
0

#Recebe a requisição para limpar a lista de transações, quando um novo bloco for minerado.
@app.route('/clear_transactions', methods=['GET', 'POST'])
def clear_transactions():
    transaction.transactions = []


#=========================================================================================================


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

    response = {'chain': blockchain.chain, 'length': len(blockchain.chain)}
    return jsonify(response), 200


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

    response = {
        'transactions': transaction.transactions,
        'length': len(transaction.transactions)
    }
    return jsonify(response), 200


#executando e definido host e porta.
app.run(debug=True, host='0.0.0.0', port=5002)
예제 #23
0
from App import app

if __name__ == "__main__":
    app.run(host='0.0.0.0', port='8080')
예제 #24
0
from App import app

if __name__ == '__main__':
    app.run(debug=1)

예제 #25
0
파일: run.py 프로젝트: ustcmzg/searchAna
# -*- coding: utf-8 -*-
                                                                      
from App import app          
                                                                       
if __name__ == '__main__':
                                                                        
    app.debug = True           # 设置调试模式,生产模式的时候要关掉debug
                                                                        
    app.run()                  # 启动服务器
예제 #26
0
from App import app

if __name__ == '__main__':
    app.run(debug=True,host="127.0.0.1",port=5000)
예제 #27
0
import os
import random
from gps import *
from time import *

x = random.randint(1000, 9999)
from App import app
if __name__ == "__main__":
    app.debug = True
    host = os.environ.get('IP', '192.168.1.14')
    port = int(os.environ.get('PORT', x))
    app.run(host=host, port=port)
예제 #28
0
#         db.session.commit()
#         login_user(user) #first time logs in -> to update the profile
#         return redirect(url_for("editProfile"))


    # Begin user session by logging the user in
    login_user(user)
#     next_page = request.args.get('next')#takes to next page after login
#     if not next_page or url_parse(next_page).netloc != '':
#         return redirect("/")

    # Send user back to homepage
    return redirect(url_for("get_home_page"))

@app.route("/upload/image", methods=['GET', 'POST'])
def upload_image():
    image_links=[]   
    if request.method == "POST":
        for image in request.files.values():
            b64 = base64.b64encode(image.read())
            data = {'image': b64, 'type': 'base64'}
            response=imgur_client.make_request('POST', 'upload', data, True)
            image_links.append(response["link"])
    
    return jsonify(image_links)    

    

if __name__ == '__main__':  # Script executed directly?
    app.run(ssl_context="adhoc")  # Launch built-in web server and run this Flask webapp
예제 #29
0
from App import app
from flask import Flask, render_template

@app.route('/', methods=['GET'])
def index():
    return render_template('index.html')
    
@app.route('/server/status/devices/<device_name>', methods=['GET'])
def status_devices(device_name):
    try:
        params = app.client.cmds.get_device(device_name)
    except:
        print("Device not found")
        params = None

    return render_template('device.html', params=params)

if __name__ == "__main__":
    app.run(debug=True)
예제 #30
0
파일: run.py 프로젝트: the-bad-wolf/hmsc
from App import app          

if __name__ == '__main__':
    app.debug = True           # 设置调试模式,生产模式的时候要关掉debug
    app.run()                  # 启动服务器
예제 #31
0
파일: start.py 프로젝트: VinWare/Society
from App import app

if __name__ == '__main__':
  app.run(host='0.0.0.0', port=5000, debug=True)
예제 #32
0
                    try:
                        #Updating the user details
                        mongo.db.user.update_one({'name':user_name}, {'$set': {'pwd': hashed_password, \
                                                                         'pwdtimestamp': date_time_stamp_string}})

                        #Generating the success message
                        resp = jsonify('User details updated')
                        resp.status_code = 200

                        #Dropping the session for this user
                        session.pop(user_name,None)

                        #Sending the response
                        return resp
                    except db_errors.PyMongoError:
                        return database_connection_error()
 
                else:
                    return wrong_password()	
            else:
                return access_not_allowed()
        except db_errors.PyMongoError:
            return database_connection_error() 
    else:
        return wrong_format_error()

if __name__ == "__main__":
    app.debug = True
    app.run(host=SERVER_ADDRESS, port=SERVER_PORT)
    app.run(debug = True)
예제 #33
0
파일: run.py 프로젝트: chenh034/pj
import os
import glo
glo.init()

from App import app

# from gevent.pywsgi import WSGIServer
if __name__ == '__main__':
    # http_server = WSGIServer(('127.0.0.1', 12306), app)
    # http_server.serve_forever()
    port = int(os.environ.get('PORT', 12306))
    app.run('127.0.0.1', port=port)
예제 #34
0
from App import app, migrate
if __name__ == '__main__':
    app.run(debug=True, port=5000)
예제 #35
0
from App import app

app.run(debug=True, host="0.0.0.0", port=11005)