Beispiel #1
0
# !/usr/bin/env python
import sys
import os

# sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append('../')
from src.views import app
from src.config import CONFIG

current_directory = os.path.dirname(os.path.abspath(__name__))
app.static('/statics', os.path.join(current_directory, 'statics'))

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=CONFIG.PORT, debug=CONFIG.DEBUG)
import os
import src
from src.views import app
from src.config import config_params as cf 

app.secret_key = os.urandom(24)
app.run(host=cf.HOST,port=cf.PORT,debug=True)
# !/usr/bin/env python
import sys

sys.path.append('../')

from src.config import CONFIG
from src.views import app

app.static('/statics', CONFIG.BASE_DIR + '/statics')

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8001)
Beispiel #4
0
from flask import Flask
from src.views import app

if __name__ == '__main__':
    app.run(host='127.0.0.1', port=8082, threaded=True)
Beispiel #5
0
#-*- coding:utf-8 -*-
__author__ = 'loadman'

from flask import  Flask , request ,url_for , g,render_template
from src.views import app

if __name__ == '__main__':
    app.run()
Beispiel #6
0
"""
The main module. It launches the threads to populate and process
the queue of events, and also starts the Flask server.
"""

import threading
from src.services import get_events, process_events, get_stream
from src.views import app

t_fetch_events = threading.Thread(target=get_events, args=(get_stream(), ))
t_process_events = threading.Thread(target=process_events)

t_fetch_events.start()
t_process_events.start()

if __name__ == "__main__":

    app.run(host="0.0.0.0")
Beispiel #7
0
from src.views import app
from src.models import db
from config import DB_URL

db.init_app(app)

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


# cli commands
@app.cli.command('resetdb')
def resetdb_command():
    """Destroys and creates the database + tables."""

    from sqlalchemy_utils import database_exists, create_database, drop_database
    if database_exists(DB_URL):
        print('Deleting database.')
        drop_database(DB_URL)
    if not database_exists(DB_URL):
        print('Creating database.')
        create_database(DB_URL)

    print('Creating tables.')
    db.create_all()
    print('ResetDB completed')
Beispiel #8
0
from flask import url_for, redirect

from src.apps.authentication.api import LoginView
from src.apps.pokemon.api import PokemonView
from src.apps.user.api import UserView
from src.views import app


@app.route('/')
def index():
    return redirect(url_for('PokemonView:pokemons'))


UserView.register(app)
PokemonView.register(app, route_base='/')
LoginView.register(app)

if __name__ == "__main__":
    app.run(debug=True, port=4201, host="127.0.0.1")