# apps/urls.py

# Retic
from retic import App as app

"""Define otras aplicaciones"""
BACKEND_EXAMPLE= {
    u"base_url": app.config.get('APP_BACKEND_EXAMPLE'),
    u"users": "/users",
}

"""Crea el objeto referencia de las apps"""
APP_BACKEND = {
    u"example": BACKEND_EXAMPLE,
}

"""Agrega las aplicaciones a Retic"""
app.use(APP_BACKEND, "backend")
示例#2
0
def application(req, res):
    """Despliegue de la aplicación

    Interface entre WSGI y la aplicación, utiliza passenger_wsgi.py
    """
    return app.application(req, res)
示例#3
0
"""Main app"""

# Retic
from retic import App as app

# Settings
import settings

# Apps
from apps import urls

# Routes
from routes import router

# Agregar las rutas a la aplicación
app.use(router)


def application(req, res):
    """Despliegue de la aplicación

    Interface entre WSGI y la aplicación, utiliza passenger_wsgi.py
    """
    return app.application(req, res)


if __name__ == "__main__":
    # Create web server
    app.listen(
        # Obtener la variable de entorno APP_HOSTNAME en el formato por defecto (str)
        hostname=app.env("APP_HOSTNAME"),
示例#4
0
def application(req, res):
    """Deploying and hosting

    We use the application from the App class, it's use for passenger_wsgi.py
    """
    return app.application(req, res)
示例#5
0
"""Main app"""

# Retic
from retic import App as app

# Settings
import settings

# Apps
from apps.urls import APP_BACKEND

# Routes
from routes.routes import router

# Add all routes
app.use(router)


def application(req, res):
    """Deploying and hosting

    We use the application from the App class, it's use for passenger_wsgi.py
    """
    return app.application(req, res)


if __name__ == "__main__":
    # Create web server
    app.listen(
        # use_reloader=True,
        # use_debugger=True,
# app.py
"""Main app"""

# Retic
from retic import Router, App as app
"""Define Router instance"""
router = Router()
"""Define paths"""
router \
    .get("/", lambda req, res, next: res.ok({"msg": "Hello world! - HTTP GET"})) \
    .post("/", lambda req, res, next: res.ok({"msg": "Hello world! - HTTP POST"})) \
    .put("/", lambda req, res, next: res.send({"msg": "Hello world! - HTTP PUT"})) \
    .delete("/", lambda req, res: res.send({"msg": "Hello world! - HTTP DELETE"}))
"""Import router to App"""
app.use(router)
"""Create web server"""
app.listen(hostname="localhost", port=1801)