Skip to content

Commit

Permalink
Move config.py into video2commons directory
Browse files Browse the repository at this point in the history
With the config moved into a json, there is no longer a good reason
for it to be outside.
  • Loading branch information
zhuyifei1999 committed Jun 10, 2017
1 parent 3fd2877 commit 7e956b5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
23 changes: 0 additions & 23 deletions config.py

This file was deleted.

3 changes: 2 additions & 1 deletion utils/cleanuptasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import sys
from redis import Redis

sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../")
sys.path.append(os.path.dirname(os.path.realpath(__file__)) +
"/../video2commons")
from config import redis_pw, redis_host # NOQA

redisconnection = Redis(host=redis_host, db=3, password=redis_pw)
Expand Down
1 change: 0 additions & 1 deletion video2commons/config.py

This file was deleted.

23 changes: 23 additions & 0 deletions video2commons/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/python
# -*- coding: UTF-8 -*-
#

"""v2c config loading from json."""

import os as _os
import json as _json

try:
with open(_os.path.dirname(_os.path.realpath(__file__)) +
'/../config.json', 'r') as f:
_data = _json.load(f)
except IOError as _e:
__import__('logging').exception(_e)
_data = {}

consumer_key = _data.get('consumer_key')
consumer_secret = _data.get('consumer_secret')
api_url = _data.get('api_url')
redis_pw = _data.get('redis_pw')
redis_host = _data.get('redis_host')
session_key = _data.get('session_key')

0 comments on commit 7e956b5

Please sign in to comment.