import sys import os CURRENT_FILE = os.path.abspath(__file__) CURRENT_DIR = os.path.dirname(CURRENT_FILE) sys.path.append(CURRENT_DIR) sys.path.append(CURRENT_DIR + '/services/') sys.path.append(CURRENT_DIR + '/Server/') sys.path.append(CURRENT_DIR + '/venv/lib/python3.8/site-packages/') from Server import app import Server.views from Server.settings import SERVER_HOST, SERVER_PORT import Server.settings as ss # start flask service if __name__ == "__main__": app.run(host=SERVER_HOST, port=SERVER_PORT, debug=True, threaded=True)
__author__ = 'adam.fitzgerald' from Server import app, set_user_agent import ConfigParser import sys import memcache config = ConfigParser.ConfigParser() config.read("config.cfg") port = config.get('global','port') user_agent = config.get('global','user_agent') debug = config.get('global', 'debug') if user_agent is None: print 'user_agent is required' sys.exit(-1) set_user_agent(user_agent) app.config['JSON_AS_ASCII'] = False app.memcached = memcache.Client([config.get('global','memcached')], debug=1) if __name__ == '__main__': port = int(port) app.debug = True app.run('0.0.0.0', port)
from Server import app import os DATA_DIRECTORY = os.getcwd() + "\\server_files\\" if __name__ == '__main__': if not os.path.exists(DATA_DIRECTORY): os.mkdir(DATA_DIRECTORY) print("Server started..") # app.run(host='192.168.1.5', port=8004, threaded=False) app.run(host='192.168.0.17', port=8004, threaded=False) print("Server stoped..")
""" This script runs the Scrapple application using a development server. """ from os import environ from Server import app from Scrapple import scrapple if __name__ == '__main__': #tesing code please remove scrapple.intialize() #scrapple.start_scraper("craigslist") #scrapple.run_spiders() HOST = environ.get('SERVER_HOST', 'localhost') try: PORT = int(environ.get('SERVER_PORT', '5555')) except ValueError: PORT = 5555 print("Server starting") app.run(HOST, PORT)
#!env/bin/python3 __author__ = 'LimeQM' from Server import app, db from flask_migrate import Migrate migrate = Migrate(app, db) class debug(): app = app def run(self): app.run(host='0.0.0.0', debug=True) if __name__ == "__main__": # db.create_all(app=app) # db.session.commit() app.run(host='0.0.0.0', debug=True)
def run(self): app.run(host='0.0.0.0', debug=True)
from Server import app if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
from Server import app app.run(debug=True)
from Server import app if __name__ == '__main__': app.run(host='0.0.0.0')
return "Just used to log in" @app.route('/login', methods=['POST', 'GET']) def login(): r = request.get_json() user = models.User.query.filter_by(email=r["email"]).first() if user and user.password == r["password"]: return {"username": user.username, "token": hashlib.sha256(bytes(user.username+user.password+salt, "utf-8")).hexdigest()} return "invalid Email or Password" @app.route('/routes', methods=['POST', 'GET']) def routes(): r = request.get_json() user = models.User.query.filter_by(username=r["username"]).first() print(user) print(user.routes) #if user and hashlib.sha256(bytes(user.username+user.password+salt)).hexdigest() == r["token"]: #return jsonify(routes=user.routes) #pass print({"routes": [{"id": i.id, "lat": i.end_lat, "lon": i.end_lon} for i in user.routes]}) return {"routes": [{"id": i.id, "lat": i.end_lat, "lon": i.end_lon} for i in user.routes]} if __name__ == '__main__': app.run(debug=True)
sys.path.append(CURRENT_DIR) sys.path.append(CURRENT_DIR + '/services/') sys.path.append(CURRENT_DIR + '/Server/') from Server import app import Server.views from Server.logger import logger from Server.settings import SERVER_HOST, SERVER_PORT import Server.settings as ss from apscheduler.schedulers.background import BackgroundScheduler from Server.job import JOB from datetime import datetime logger.info("Start Server") # start scheduler scheduler = BackgroundScheduler() scheduler.add_job(JOB, ss.SCHEDULER_MODE, seconds=ss.SCHEDULER_INTERVAL, next_run_time=datetime.now()) scheduler.start() # start flask service if __name__ == "__main__": app.run(host=SERVER_HOST, port=SERVER_PORT, debug=True, threaded=True, use_reloader=False)
from Server import app if __name__ == "__main__": app.run()
from Server import app if __name__ == "__main__": app.run(threaded=True)
""" Runnes server for production use """ from Server import app app.run(host='0.0.0.0',port=80)