Beispiel #1
0
 def db(self):
     # slightly crappy: anything that changes self.db_address should also del(self.db)
     return db.Db(self.db_address)
Beispiel #2
0
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os

from utils import db

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'schoolmate.settings')
APPS = ('school', 'account', 'news', 'timetable', 'diary', 'notebook')

if __name__ == '__main__':
    import django
    django.setup()
    from django.conf import settings
    _db = db.Db(settings.DATABASES['default'], settings.BASE_DIR)

    _db.create()
    for a in APPS:
        _db.remove_migrations(a)
    for a in APPS:
        _db.make_migrations(a)
    _db.migrate()
Beispiel #3
0
 def client(self):
     # slightly crappy: anything that changes self.address should also del(self.client)
     return db.Db(self.address)
Beispiel #4
0
import datetime
import logging

# Loading app config
config_parser = ConfigParser.RawConfigParser()
config_path = 'conf/defaults.cfg'
config_parser.read(config_path)

# Loading logger
date = datetime.datetime.now()
formated_date = "%s_%s_%s" % (date.day, date.month, date.year)
logging.basicConfig(
    filename='logs/get_links_' + formated_date + '.log',
    filemode='a',
    format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
    datefmt='%H:%M:%S',
    level=config_parser.get('logging', 'level'))

# Loading mongodb connection instance
utils = utils.Init_instances(config_parser)
mongodb = db_initiator.Db(config_parser, utils)

# Web spider. Generating target links.
#web_spider.get_links(mongodb)

# Web Parser. Parsing each recipe link
#web_parser.get_recipes(mongodb)

# Data cleaner. Clean data to extract ingredients from raw recipes
data_cleaner.recipes_clean(mongodb)