예제 #1
0
 def test_run_withhout_appium(self, mocked_avd, mocked_subprocess):
     with mock.patch('src.app.appium_run') as mocked_appium:
         os.environ['APPIUM'] = str(False)
         app.run()
         self.assertTrue(mocked_avd.called)
         self.assertTrue(mocked_subprocess.called)
         self.assertFalse(mocked_appium.called)
예제 #2
0
파일: test_app.py 프로젝트: 5ardalla/galxy
 def test_run_with_appium(self, mocked_avd, mocked_open, mocked_subprocess):
     with mock.patch('src.app.appium_run') as mocked_appium:
         os.environ['APPIUM'] = str(True)
         app.run()
         self.assertTrue(mocked_avd.called)
         self.assertTrue(mocked_subprocess.called)
         self.assertTrue(mocked_appium.called)
예제 #3
0
 def test_run_without_appium(self, mocked_avd, mocked_subprocess):
     with mock.patch('src.app.appium_run') as mocked_appium:
         os.environ['AVD'] = str(False)
         os.environ['APPIUM'] = str(False)
         app.run()
         self.assertFalse(mocked_avd.called)
         self.assertFalse(mocked_subprocess.called)
         self.assertFalse(mocked_appium.called)
예제 #4
0
 def test_run_without_avd(self, mocked_appium):
     with mock.patch('src.app.prepare_avd') as mocked_avd:
         with mock.patch('subprocess.Popen') as mocked_subprocess:
             os.environ['AVD'] = str(False)
             os.environ['APPIUM'] = str(False)
             app.run()
             self.assertFalse(mocked_avd.called)
             self.assertFalse(mocked_subprocess.called)
             self.assertFalse(mocked_appium.called)
예제 #5
0
def run(host, port, debug):
    """Runs a development web server."""
    if debug:
        from src import app
        app.run(host=host, port=port, debug=debug)
    else:
        bind = '%s:%s' % (host, port)
        subprocess.call(
            ['gunicorn', 'src:app', '--bind', bind, '--log-file=-'])
예제 #6
0
파일: test_app.py 프로젝트: 5ardalla/galxy
 def test_run_with_appium_and_relaxed_security(self, mocked_avd,
                                               mocked_open,
                                               mocked_subprocess):
     with mock.patch('src.app.appium_run') as mocked_appium:
         os.environ['APPIUM'] = str(True)
         os.environ['RELAXED_SECURITY'] = str(True)
         app.run()
         self.assertTrue(mocked_avd.called)
         self.assertTrue(mocked_subprocess.called)
         self.assertTrue(mocked_appium.called)
예제 #7
0
파일: app.py 프로젝트: hyojupark/flask-vue
    def run(self) -> bool:
        self.register_views()

        app.jinja_env.globals['url_for_other_page'] = self.url_for_other_page
        app.run(host=self.host,
                port=self.port,
                debug=self.debug,
                use_reloader=self.use_reloader,
                threaded=self.threaded)

        return True
class check:
    count = 0

    if count == 0:
        print(count)
        count += 1
    global APP_ROOT, app

    app = Flask(__name__)

    APP_ROOT = os.path.dirname(os.path.abspath(__file__))

    @staticmethod
    def get_files():

        from os import listdir
        from os.path import isfile, join

        mypath = '/home/momo/PycharmProjects/Malware_Analysis/src/images/'

        onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
        for f in onlyfiles:
            print(f)

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

    @staticmethod
    @app.route("/upload", methods=['POST'])
    def upload():
        target = os.path.join(APP_ROOT, 'images/')
        # print(target)

        if not os.path.isdir(target):
            os.mkdir(target)

        for file in request.files.getlist("file"):
            # print(file)
            filename = file.filename
            destinaton = "/".join([target, filename])
            # print(destinaton)
            file.save(destinaton)

        from src import app
        app.check.get_files()

        return 'File uploaded!'
        #return render_template("complete.html")

    if __name__ == '__main__':
        app.run(port=4555)
예제 #9
0
from src import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True, port=5000, threaded=False)
예제 #10
0
# from flask import Flask
# from flask import render_template, request, redirect, url_for
from src import app


if __name__ == "__main__":
    app.run('localhost', '8080')
예제 #11
0
from src.utils.load_config import config
from src import app

if __name__ == "__main__":
    app.run(debug=config.DEBUG, host=config.HOST, port=config.PORT)
예제 #12
0
from src import app

if __name__ == '__main__':
    app.run(port=5000, host="0.0.0.0")
예제 #13
0
from flask_script import Manager, Server
from src import app

manager = Manager(app)
manager.add_command("runserver", Server('0.0.0.0', port=3001))

Application = app

if __name__ == '__main__':
    # manager.run()
    app.run(debug=True, host='0.0.0.0', port=3001)
예제 #14
0
import os
from src import app

if __name__ == "__main__":
    HOST = os.environ.get("SERVER_HOST", "localhost")
    try:
        PORT = int(os.environ.get("SERVER_PORT", "5555"))
    except ValueError:
        PORT = 1234
    app.secret_key = "1cd6f35db029d4b8fc98fc05c9efd06a2e2cd1ffc3774d3f035ebd8d"
    app.run(HOST, PORT, debug=True)
예제 #15
0
파일: blog.py 프로젝트: Rootex/Blog
    name = "Sot"
    return render_template('profile.html', name = name)


def allowed_filename(filename):
    return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS


@app.route('/edit', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        file = request.files['file']
        if file and allowed_filename(file.filename):
            filename = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            return redirect(url_for('uploaded_file', filename=filename))
    return render_template('edit.html')


@app.route('/uploads/<filename>')
def uploaded_file(filename):
    return send_from_directory(app.config['UPLOAD_FOLDER'], filename)


with app.test_request_context():
    print(url_for('index'))

if __name__ == "__main__":
    app.debug = True
    app.run()
예제 #16
0
from src import app

if __name__ == "__main__":
    # app.run()
    app.run(host="0.0.0.0", port=80)
예제 #17
0
파일: runserver.py 프로젝트: MuShMe/MuShMe
#!/usr/bin/python
from src import app
 
app.debug = True
app.run();
예제 #18
0
from src import app

__author__ = "Nupur Baghel"

app.run(debug=app.config['DEBUG'],port=4995)
예제 #19
0
#! /usr/bin/env python

import os, sys, platform

minor = "py2{0}".format(sys.version_info[1])
if os.name == "posix":
    if platform.system() == "Darwin":
        sys.path.append(os.path.join("./lib/osx", minor))
    else:
        if platform.architecture()[0] == "64bit":
            sys.path.append(os.path.join("./lib/lin64", minor))
        else:
            sys.path.append(os.path.join("./lib/lin32", minor))
else:
    sys.path.append(os.path.join("./lib/win32", minor))

from src import app, scenes

editor = scenes.get("editor")()
app = app.Application()
app.run(editor)
예제 #20
0
# !/usr/bin/env python
# -*- coding: utf-8 -*-

from src import app
from src.controllers import controllers
from src.services import services

app.register_blueprint(controllers)
app.register_blueprint(services)

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0')
    #app.run()
    
예제 #21
0
파일: mushme.py 프로젝트: MuShMe/MuShMe
    file_handler.setLevel(logging.WARNING)
    app.logger.addHandler(file_handler)

    from logging import Formatter
mail_handler.setFormatter(Formatter('''
    Message type:       %(levelname)s
    Location:           %(pathname)s:%(lineno)d
    Module:             %(module)s
    Function:           %(funcName)s
    Time:               %(asctime)s

    Message:

    %(message)s
    '''))



if __name__ == """__main__""":
    # To allow aptana to receive errors, set use_debugger=False
    app = create_app(config="""config.yaml""")

    if app.debug: use_debugger = True
    try:
        # Disable Flask's debugger if external debugger is requested
        use_debugger = not(app.config.get('DEBUG_WITH_APTANA'))
    except:
        pass
    app.run(use_debugger=use_debugger, 
            use_reloader=use_debugger, threaded=True, port=8080)
예제 #22
0
from src import app
if __name__ == '__main__':
    app.run(debug=True, port=8000)
#!flask/bin/python
from src import app
app.run(debug=True,port=3030)
예제 #24
0
"""
This script runs the application.
"""

from os import environ
from src import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
예제 #25
0
파일: run.py 프로젝트: seraph0017/landrover
def w():
    app.run(debug=True)
예제 #26
0
from src import app

if __name__ == '__main__':
    app.run(host='localhost', port=5000, debug=1)
예제 #27
0
def main():
    # from werkzeug.contrib.profiler import ProfilerMiddleware
    # app.config["PROFILE"] = True
    # app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])

    app.run(host="0.0.0.0", debug=True)
예제 #28
0
파일: run.py 프로젝트: aargudo1910/peps
from flask import Flask
from src import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=3000, debug=True)
예제 #29
0
파일: run.py 프로젝트: spchuang/community
import os
from src import app

if __name__ == '__main__':
   port = int(os.environ.get("PORT", 5000))
   app.run(host='0.0.0.0', port=port, debug=True)
   
예제 #30
0
파일: run.py 프로젝트: aloari/flask-app
import logging
from logging.handlers import RotatingFileHandler
from datetime import date

from src import app

handler = RotatingFileHandler('log_{}.log'.format(
    date.today().strftime('%Y-%m-%d')),
                              maxBytes=10000,
                              backupCount=1)
formatter = logging.Formatter(
    "[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s")
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)
app.logger.addHandler(handler)
app.logger.setLevel(logging.DEBUG)

app.run(debug=True, host='0.0.0.0')
예제 #31
0
import os
from src import app


if __name__ == '__main__':
  port = int(os.environ.get('PORT', 5000))  # default to 5000
  app.run(host='0.0.0.0', port=port)
예제 #32
0
from src import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8080)
예제 #33
0
from src import app

if __name__=='__main__':
    app.run(host='0.0.0.0')
예제 #34
0
                        os.path.join(result_base_dir_path, product, version,
                                     sub_version))
                    for sub_category in config_dir[product][sub_version].keys(
                    ):
                        makedir(
                            os.path.join(result_base_dir_path, product,
                                         version, sub_version, sub_category))
                        for category in config_dir[product][sub_version][
                                sub_category]:
                            makedir(
                                os.path.join(result_base_dir_path, product,
                                             version, sub_version,
                                             sub_category, category))
                else:
                    for sub_category in config_dir[product][sub_version].keys(
                    ):
                        makedir(
                            os.path.join(result_base_dir_path, product,
                                         version, sub_version, sub_category))
                        for category in config_dir[product][sub_version][
                                sub_category]:
                            makedir(
                                os.path.join(result_base_dir_path, product,
                                             version, sub_version,
                                             sub_category, category))


if __name__ == "__main__":
    create_directory_structure(create_file_structure)
    app.run(debug=True, host='0.0.0.0', port=port)
예제 #35
0
파일: app.py 프로젝트: pacmad/TicketBox-9
from src import app
from flask import render_template
import os
from itsdangerous import URLSafeTimedSerializer


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


if __name__ == '__main__':
    app.run(debug=True)
예제 #36
0
'''
    * Starting point of the application
'''

# import app & configs
from src import app
from src.web_config import CONFIG

# start the app
app.run(host=CONFIG['host'], port=CONFIG['port'])
예제 #37
0
from src import app
app.run(debug=True, use_reloader=False)
from src import app, db
from src.models import Subject, Teacher, Group, Impart, KnowledgeArea, PDA, UniversityDegree, User, Tutorial


@app.shell_context_processor
def make_shell_context():
    return {
        'db': db,
        'Subject': Subject,
        'Teacher': Teacher,
        'Group': Group,
        'Impart': Impart,
        'KnowledgeArea': KnowledgeArea,
        'UniversityDegree': UniversityDegree,
        'PDA': PDA,
        'User': User,
        'Tutorial': Tutorial,
    }


if __name__ == '__main__':
    app.run(host='localhost', debug=True)
예제 #39
0
파일: run.py 프로젝트: nomade/watson
import os
from src import app

if __name__ == '__main__':
	app.run(host='0.0.0.0', port=9090, debug=True)
예제 #40
0
from src import app

app.secret_key = 'super secret key'
app.config['SESSION_TYPE'] = 'filesystem'

app.debug = True
app.run(host='127.0.0.1', port=80, debug=True)


# from flask import Flask
# from flask import Flask, flash, redirect, render_template, request, session, abort
# import os
#
# app = Flask(__name__)
#
#
# @app.route('/')
# def home():
#     if not session.get('logged_in'):
#         return render_template('login.html')
#     else:
#         return "Hello Boss!"
#
#
# @app.route('/login', methods=['POST'])
# def do_admin_login():
#     if request.form['password'] == 'password' and request.form['username'] == 'admin':
#         session['logged_in'] = True
#     else:
#         flash('wrong password!')
#     return home()
예제 #41
0
from src import app


app.run(debug=True, host="0.0.0.0", port=5000)
예제 #42
0
#!/usr/bin/env python3

from src import app

if __name__ == "__main__":
    app.run()
import os
from src import app

port = int(os.environ.get("PORT", 5000))
app.run(host='0.0.0.0', port=port, debug=False)
예제 #44
0
                groups[grp]['rules'][rule]['stats']['pass'] += 1
            else:
                groups[grp]['rules'][rule]['stats']['fail'] += 1

            groups[grp]['rules'][rule]['messages'].append({
                'message':
                entry['message'],
                'status':
                entry['result'],
                'region':
                entry['region']
            })

    for g in groups:
        groups[g]['rules'] = list(groups[g]['rules'].values())
    final_result = {'results': list(groups.values())}
    return final_result


@app.route('/rule_results')
def rule_results():
    #   print(json.dumps(final_result))
    final_result = get_run_results(res_groups, [ALL], [ALL])
    return jsonify(meta="success", result=final_result)


if __name__ == '__main__':
    #db.create_all()
    #db.session.close()
    app.run(debug=True, host='0.0.0.0', port=4000)
예제 #45
0
파일: app.py 프로젝트: 764664/BioSE
from src import app
from src.helpers.update import update
import os

if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
    update()
app.run(debug=True, host='0.0.0.0', threaded=True)

예제 #46
0
from src import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=4000, debug=True)
예제 #47
0
#from __future__ import with_statement #<-necessary if server uses python 2.5
from flask import Flask, request, render_template
import os, sys, email_fetch, db_interface
from contextlib import closing
from src import app

#app = Flask(__name__)
app.config.from_object('monitor_app_config')

@app.route("/")
def main():
	emails = email_fetch.get_messages()
	return render_template('messages.html', msg=emails)


if __name__ == "__main__":
    app.run(debug=True)
예제 #48
0
#!/usr/bin/env python3
"""
Title: ATCF HTTP Server
Description: A Flask-based HTTP server that returns data from the ATCF in JSON format.
"""
# 3rd party modules
from threading import Thread

# Local modules
from src import ATCFServer, DevelopmentConfig, app

config = DevelopmentConfig

if __name__ == "__main__":
    Thread(target=ATCFServer, daemon=True).start()  # Read class description
    # Server will try to use ip and port defined in .env.  If not found, it will use default values
    Thread(app.run(host=config.FLASK_IP,
                   port=config.FLASK_PORT,
                   debug=config.DEBUG,
                   use_reloader=config.RELOADER), daemon=True).start()  # Flask server
예제 #49
0
import sys
import os.path as op; __dir__ = op.dirname(op.abspath(__file__))

sys.path.insert(0, op.dirname(__dir__))

from src import app


app.run('localhost', 5000)