for django in sae
Project description
#django-sae
[![PyPI version](https://badge.fury.io/py/django-sae.png)](http://badge.fury.io/py/django-sae)
用于新浪云平台SAE
### 扩展命令
* compress_site_packages:压缩 site_packages
* upgrade_requirements:更新requirements.txt中所有依赖的库
* sae_migrate:切换到SAE数据库,并进行migrate操作
* sae_schemamigration:切换到SAE数据库,并进行schemamigration操作
* sae_syncdb:切换到SAE数据库,并进行syncdb操作
使用sae_migrate、sae_schemamigration、sae_syncdb等数据库相关的扩展命令时,请在settings中进行如下设置:
```python
MYSQL_DB=u'SAE数据库名称'
MYSQL_USER=u'SAE数据库用户名称'
MYSQL_PASS=u'SAE数据库用户密码'
```
### 数据库
如需数据库读写操作分离,请在settings中进行如下设置:
```python
from sae.const import MYSQL_HOST, MYSQL_HOST_S, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': MYSQL_DB,
'USER': MYSQL_USER,
'PASSWORD': MYSQL_PASS,
'HOST': MYSQL_HOST,
'PORT': MYSQL_PORT,
'OPTIONS': {'init_command': "SET storage_engine=MYISAM;"},
},
'slave': {
'ENGINE': 'django.db.backends.mysql',
'NAME': MYSQL_DB,
'USER': MYSQL_USER,
'PASSWORD': MYSQL_PASS,
'HOST': MYSQL_HOST_S,
'PORT': MYSQL_PORT,
'OPTIONS': {'init_command': "SET storage_engine=MYISAM;"},
},
}
DATABASE_ROUTERS = ['django_sae.db.routers.MasterSlaveRouter']
```
### 缓存
使用 SAE Memcache 服务时,请在settings中进行如下设置:
```python
CACHES={
'default': {
'BACKEND': 'django_sae.cache.backends.SaePyLibMCCache',
}
}
```
.. :changelog:
Release History
---------------
0.1.18 (2014-03-19)
++++++++++++++++++
- 添加扩展命令:upgrade_requirements
0.1.13 (2014-03-18)
++++++++++++++++++
- 重命名扩展命令: updatepackages -> compress_site_packages,
- 添加扩展命令:sae_migrate, sae_schemamigration, sae_syncdb
0.1.11 (2014-03-17)
++++++++++++++++++
- commands(扩展命令): updatepackages(更新依赖库并压缩为site-packages.zip)
0.1.1 (2014-03-16)
++++++++++++++++++
- patches: 自动设置
- conf: SAE平台的默认设置
0.1.0 (2014-03-15)
++++++++++++++++++
- db: 通用模型和读写分离
- cache: 缓存模型
- utils: 时间戳模块和装饰模块
- tasks: 用于执行任务
[![PyPI version](https://badge.fury.io/py/django-sae.png)](http://badge.fury.io/py/django-sae)
用于新浪云平台SAE
### 扩展命令
* compress_site_packages:压缩 site_packages
* upgrade_requirements:更新requirements.txt中所有依赖的库
* sae_migrate:切换到SAE数据库,并进行migrate操作
* sae_schemamigration:切换到SAE数据库,并进行schemamigration操作
* sae_syncdb:切换到SAE数据库,并进行syncdb操作
使用sae_migrate、sae_schemamigration、sae_syncdb等数据库相关的扩展命令时,请在settings中进行如下设置:
```python
MYSQL_DB=u'SAE数据库名称'
MYSQL_USER=u'SAE数据库用户名称'
MYSQL_PASS=u'SAE数据库用户密码'
```
### 数据库
如需数据库读写操作分离,请在settings中进行如下设置:
```python
from sae.const import MYSQL_HOST, MYSQL_HOST_S, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': MYSQL_DB,
'USER': MYSQL_USER,
'PASSWORD': MYSQL_PASS,
'HOST': MYSQL_HOST,
'PORT': MYSQL_PORT,
'OPTIONS': {'init_command': "SET storage_engine=MYISAM;"},
},
'slave': {
'ENGINE': 'django.db.backends.mysql',
'NAME': MYSQL_DB,
'USER': MYSQL_USER,
'PASSWORD': MYSQL_PASS,
'HOST': MYSQL_HOST_S,
'PORT': MYSQL_PORT,
'OPTIONS': {'init_command': "SET storage_engine=MYISAM;"},
},
}
DATABASE_ROUTERS = ['django_sae.db.routers.MasterSlaveRouter']
```
### 缓存
使用 SAE Memcache 服务时,请在settings中进行如下设置:
```python
CACHES={
'default': {
'BACKEND': 'django_sae.cache.backends.SaePyLibMCCache',
}
}
```
.. :changelog:
Release History
---------------
0.1.18 (2014-03-19)
++++++++++++++++++
- 添加扩展命令:upgrade_requirements
0.1.13 (2014-03-18)
++++++++++++++++++
- 重命名扩展命令: updatepackages -> compress_site_packages,
- 添加扩展命令:sae_migrate, sae_schemamigration, sae_syncdb
0.1.11 (2014-03-17)
++++++++++++++++++
- commands(扩展命令): updatepackages(更新依赖库并压缩为site-packages.zip)
0.1.1 (2014-03-16)
++++++++++++++++++
- patches: 自动设置
- conf: SAE平台的默认设置
0.1.0 (2014-03-15)
++++++++++++++++++
- db: 通用模型和读写分离
- cache: 缓存模型
- utils: 时间戳模块和装饰模块
- tasks: 用于执行任务
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-sae-0.1.20.zip
(31.5 kB
view details)
File details
Details for the file django-sae-0.1.20.zip
.
File metadata
- Download URL: django-sae-0.1.20.zip
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2003a0b002067fb8b43c5dab42cd4d8cf049ca12c0b011cd621f0b4d2a4f962a |
|
MD5 | cb2fdcadcc842e95e2dc0594768c2229 |
|
BLAKE2b-256 | 1ec6b32ecd406cb8a6dd7aef58f5267eba711efd9d532a8e360439f9e9e308d9 |