示例#1
0
文件: wsgi.py 项目: adamwen829/vilya
# -*- coding: utf-8 -*-

import os
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from sina import Sina
from sina.config import DEFAULT_CONFIG

from vilya import api, frontend
from vilya.middleware import GitDispatcher

frontend_app = frontend.create_app()
api_app = api.create_app()
PROJECT_ROOT = api_app.config['REPO_PATH']
DEFAULT_CONFIG['project_root'] = PROJECT_ROOT
DEFAULT_CONFIG['chunked'] = True
sina_app = Sina(DEFAULT_CONFIG)


@sina_app.get_repo_path
def get_repo_path_handler(environ, path):
    with api_app.app_context():
        from vilya.services import users, projects
        user = users.get_by_name_path(path)
        if user:
            print user.name
        project = projects.get_by_name_path(path)
        return os.path.join(PROJECT_ROOT, project.path)


@sina_app.has_permission
示例#2
0
 def _create_app(self, settings):
     return create_app(settings)
示例#3
0
文件: manage.py 项目: alexband/vilya
# -*- coding: utf-8 -*-

from flask.ext.script import Manager

from vilya.api import create_app
from vilya.manage import CreateUserCommand, DeleteUserCommand, ListUsersCommand

manager = Manager(create_app())
manager.add_command('create_user', CreateUserCommand())
manager.add_command('delete_user', DeleteUserCommand())
manager.add_command('list_users', ListUsersCommand())

if __name__ == "__main__":
    manager.run()
示例#4
0
文件: wsgi.py 项目: alexband/vilya
# -*- coding: utf-8 -*-

from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware

from vilya import api, frontend

application = DispatcherMiddleware(frontend.create_app(), {
    '/api': api.create_app()
})

if __name__ == "__main__":
    run_simple('0.0.0.0', 5000, application, use_reloader=True, use_debugger=True)
示例#5
0
文件: wsgi.py 项目: shanzi/code-vilya
# -*- coding: utf-8 -*-

from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware

from vilya import frontend, api
from vilya.middleware import DispatcherMiddleware as GitDispatcherMiddleware

frontend_app = frontend.create_app()
frontend_app.wsgi_app = GitDispatcherMiddleware(frontend_app)
application = frontend_app
vilya_app = DispatcherMiddleware(frontend_app, {"/api": api.create_app()})


if __name__ == "__main__":
    run_simple("localhost", 5000, vilya_app, use_reloader=True, use_debugger=True)
示例#6
0
文件: env.py 项目: adamwen829/vilya
from __future__ import with_statement

import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(abspath(__file__))))

from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig

from vilya.models import *
from vilya.core import db
from vilya.api import create_app

app = create_app()

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.


def run_migrations_offline():