@@ -33,9 +33,6 @@ from utils.time_utils import origin_expired_stamps |
||
33 | 33 |
from utils.url_utils import img_url, share_url |
34 | 34 |
|
35 | 35 |
|
36 |
-# db = records.Database(settings.DATABASE_URL['default']) |
|
37 |
- |
|
38 |
- |
|
39 | 36 |
@logit |
40 | 37 |
@transaction.atomic |
41 | 38 |
def group_create_api(request): |
@@ -618,13 +615,6 @@ def pai2_home_api(request): |
||
618 | 615 |
)) |
619 | 616 |
rows = cursor.fetchall() |
620 | 617 |
|
621 |
- # 使用 records 执行原生 SQL 语句,获取首页照片列表 |
|
622 |
- # rows = db.query(PAI2_HOME_API.format( |
|
623 |
- # user_id=user_id, |
|
624 |
- # offset=0, |
|
625 |
- # rows=settings.PAI2_HOME_MAX_ROWS, |
|
626 |
- # )).all() |
|
627 |
- |
|
628 | 618 |
# 首页照片分页 |
629 | 619 |
rows, left = pagination(rows, page, num) |
630 | 620 |
|
@@ -659,16 +649,6 @@ def pai2_home_api(request): |
||
659 | 649 |
'porder': get_lensman_order_record(row[5], user_id) if row[20] == GroupPhotoInfo.SESSION_GROUP else {}, |
660 | 650 |
} for row in rows] |
661 | 651 |
|
662 |
- # rows = [dict(row) for row in rows] |
|
663 |
- # [row.update({ |
|
664 |
- # 'photo_url': img_url(row['photo_path']), |
|
665 |
- # 'photo_thumbnail_url': img_url(row['photo_thumbnail_path']), |
|
666 |
- # 'photo_thumbnail2_url': img_url(row['photo_thumbnail2_path']), |
|
667 |
- # 'photo_share_url': share_url(row['photo_id']), |
|
668 |
- # 'thumbup': get_group_photo_thumbup_flag(row['photo_id'], user_id), |
|
669 |
- # 'porder': get_lensman_order_record(row['photo_id'], user_id) if row['photo_from'] == GroupPhotoInfo.SESSION_GROUP else {}, |
|
670 |
- # }) for row in rows] |
|
671 |
- |
|
672 | 652 |
return response(200, 'Get Home Data Success', u'获取首页数据成功', { |
673 | 653 |
'photos': rows, |
674 | 654 |
'left': left, |
@@ -144,33 +144,6 @@ DATABASES = { |
||
144 | 144 |
} |
145 | 145 |
} |
146 | 146 |
|
147 |
-SCHEMES = { |
|
148 |
- 'django.db.backends.postgresql_psycopg2': 'postgres', |
|
149 |
- 'django.db.backends.postgresql_psycopg2': 'postgresql', |
|
150 |
- 'django.db.backends.postgresql_psycopg2': 'pgsql', |
|
151 |
- 'django.contrib.gis.db.backends.postgis': 'postgis', |
|
152 |
- 'django.db.backends.mysql': 'mysql', |
|
153 |
- # 'django.db.backends.mysql': 'mysql2', |
|
154 |
- 'django.contrib.gis.db.backends.mysql': 'mysqlgis', |
|
155 |
- 'mysql.connector.django': 'mysql-connector', |
|
156 |
- 'django.contrib.gis.db.backends.spatialite': 'spatialite', |
|
157 |
- 'django.db.backends.sqlite3': 'sqlite', |
|
158 |
- 'django.db.backends.oracle': 'oracle', |
|
159 |
- 'django.contrib.gis.db.backends.oracle': 'oraclegis', |
|
160 |
-} |
|
161 |
- |
|
162 |
-DATABASE_URL = { |
|
163 |
- k: '{scheme}://{user}:{password}@{host}:{port}/{name}?charset={charset}'.format( |
|
164 |
- scheme=SCHEMES[v.get('ENGINE', '')], |
|
165 |
- user=v.get('USER', 'root'), |
|
166 |
- password=v.get('PASSWORD', ''), |
|
167 |
- host=v.get('HOST', 'localhost'), |
|
168 |
- port=v.get('PORT', 6039), |
|
169 |
- name=v.get('NAME', ''), |
|
170 |
- charset=v.get('OPTIONS', {}).get('charset', 'utf8'), |
|
171 |
- ) for k, v in DATABASES.iteritems() |
|
172 |
-} |
|
173 |
- |
|
174 | 147 |
# Internationalization |
175 | 148 |
# https://docs.djangoproject.com/en/1.8/topics/i18n/ |
176 | 149 |
|
@@ -31,7 +31,6 @@ pysnippets==1.0.4 |
||
31 | 31 |
pywe-miniapp==1.0.0 |
32 | 32 |
pywe-oauth==1.0.3 |
33 | 33 |
pywe-response==1.0.1 |
34 |
-records==0.4.3 |
|
35 | 34 |
redis-extensions==1.0.49 |
36 | 35 |
requests==2.12.4 |
37 | 36 |
rlog==0.2 |