Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A base bridge between django framework and our private application.

Project Description
# [ Django base bridge ]

# 功能概述

放在我们应用和django内部框架之间的桥接基类,目的是在不修改django源码的情况下可以定制某些模块。

# 依赖

* Python (2.7.X)
* Django (1.7+)

# 安装

# 克隆代码到本地

git clone https://github.com/evilloop/django-base-bridge

# 进入目录

cd django-base-bridge

# 三步安装法
python setup.py config
python setup.py build
python setup.py install

# 用法

db
===
重新封装了一层原来的Model和fields,便于定制

from base_bridge.db import models


class Project(models.Model):
class Meta:
verbose_name = verbose_name_plural = u'Project'

name = models.CharField(verbose_name=u'名称')
desc = models.TextField(verbose_name=u'描述')

views
===
视图装饰器,记录日志和异常处理

View装饰器,调用之前需要重写以下函数:
- request_pre_process
- request_exception_process

from base_bridge.views.decorators import BaseDecorator
class BeforeView(BaseDecorator):
@classmethod
def request_pre_process(cls, request):
'''
Do something
'''
pass

@classmethod
def request_exception_process(cls, request, e):
'''
Do something
'''
pass

@BeforeView.catch_exception_without_parameters
def some_view(request):
pass

utils
=====
工具函数

from base_bridge.utils.settings import get_settings
get_settings() 直接返回settings模块对象

from base_bridge.utils.http import response_as_json
response_as_json(request, obj, headers, before_response) 构造json返回客户端
Release History

Release History

This version
History Node

1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
base_bridge-1.0.tar.gz (7.2 kB) Copy SHA256 Checksum SHA256 Source Feb 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting