Ejemplo n.º 1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# ..
import logging, argparse

# ...
import yask, config, urls, models

app = yask.App()
# ...
config.init(app)
app.init_logger()
urls.init(app)
models.init(app)

# ...
if __name__ == "__main__":
    # ...
    parser = argparse.ArgumentParser(description='Setup defaults')
    # ..
    parser.add_argument('--host',
                        dest='host',
                        default=app.config.HOST,
                        help='Default hostname')
    # ...
    parser.add_argument('--port',
                        dest='port',
                        type=int,
                        default=app.config.PORT,
                        help='Default port')
Ejemplo n.º 2
0
from flask import Flask, make_response, jsonify
import settings
import urls

app = Flask('nibiru-api')
app.config.from_object(settings)


@app.errorhandler(404)
def not_found(error):
    return make_response(jsonify({'error': 'Not found'}), 404)


urls.init(app)
Ejemplo n.º 3
0
Archivo: app.py Proyecto: LarryEitel/e1
#import wingdbstub
import os
from bottle import run, debug, Bottle
import bottle_mongo as bottle_mongo
import urls
# sys.path.append('C:\\Users\\Larry\\__prjs\\_ex\\_prjs\\ab')

# init app
app = Bottle(autojson=False)
app.install(bottle_mongo.MongoPlugin(uri="localhost", db="ex", json_mongo=True))

#------ Here is where we init all routes
app = urls.init(app)

if __name__ == "__main__":
    if os.environ.get("DEV"):
        print "Starting as DEV"
        debug(True)
        run(app=app, host="127.0.0.1", port=os.environ.get("PORT", 3000), reloader=True)
    else:
        run(app=app, host="127.0.0.1", port=os.environ.get("PORT", 3000))