From 64e66b9f832b8d5855d7aa3e1cc7df4d90fa3a32 Mon Sep 17 00:00:00 2001 From: Alexandr Nesterenko Date: Thu, 13 Jul 2017 11:06:34 -0700 Subject: [PATCH] mysql connection to utf8 --- feed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/feed.py b/feed.py index 84cdfd2..092c174 100644 --- a/feed.py +++ b/feed.py @@ -13,7 +13,7 @@ from settings import DATABASES, DOWNLOADER_USER_AGENT url_hash_regexp = re.compile('(#.*)?$') -POST_TIME_DISTANCE = 15 # minutes +POST_TIME_DISTANCE = 15 # minutes, RSS Feed Reader skip same titles created in 10 min interval FIELD_IDS = {'title': 1, 'description': 2, 'title_link': 3} @@ -161,6 +161,6 @@ def getFeedData(request, feed_id): def get_conn(): creds = DATABASES['default'] - db = MySQLdb.connect(host=creds['HOST'], port=int(creds['PORT']), user=creds['USER'], passwd=creds['PASSWORD'], db=creds['NAME']) + db = MySQLdb.connect(host=creds['HOST'], port=int(creds['PORT']), user=creds['USER'], passwd=creds['PASSWORD'], db=creds['NAME'], init_command='SET NAMES UTF8') db.autocommit(True) return db