Exemple #1
0
# Initialize django
import os.path
import exportrecipe

BUILDOUT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                            '../..'))
config = exportrecipe.load(os.path.join(BUILDOUT_DIR, 'settings.json'))
os.environ['DJANGO_SETTINGS_MODULE'] = config.django_settings
import django

django.setup()

BOT_NAME = 'manoseimas.lt'

SPIDER_MODULES = ['manoseimas.scrapy.spiders']
NEWSPIDER_MODULE = 'manoseimas.scrapy.spiders'
DEFAULT_ITEM_CLASS = 'manoseimas.scrapy.items.Person'
USER_AGENT = '%s/1.1' % (BOT_NAME)

LOG_ENABLED = True
LOG_LEVEL = 'WARNING'  # CRITICAL, ERROR, WARNING, INFO, DEBUG
# LOG_FILE = os.path.join(settings.BUILDOUT_DIR, 'var', 'log', 'scrapy.log')

ITEM_PIPELINES = [
    'scrapy.contrib.pipeline.images.ImagesPipeline',
    'manoseimas.scrapy.pipelines.ManoseimasPipeline',
    'manoseimas.scrapy.pipelines.ManoSeimasModelPersistPipeline',
]

DOWNLOADER_MIDDLEWARES = {
    'manoseimas.scrapy.downloadermiddleware.NoCacheInitialURLMiddleware': 1
Exemple #2
0
import exportrecipe
import pathlib

from django.utils.translation import ugettext_lazy as _

PROJECT_DIR = pathlib.Path(__file__).parents[2]

config = exportrecipe.load(str(PROJECT_DIR / 'settings.json'))


# Django base settings
# https://docs.djangoproject.com/en/stable/ref/settings/

DEBUG = False
ROOT_URLCONF = 'dakis.website.urls'
SECRET_KEY = config.secret_key
MEDIA_URL = '/media/'
MEDIA_ROOT = str(PROJECT_DIR / 'var/www/media')
STATIC_URL = '/static/'
STATIC_ROOT = str(PROJECT_DIR / 'var/www/static')
LANGUAGE_CODE = 'en'
LANGUAGES = (
    ('lt', _('Lithuanian')),
    ('en', _('English')),
)
LOCALE_PATHS = (
    str(PROJECT_DIR / 'dakis/locale'),
)

INSTALLED_APPS = (
    'django.contrib.staticfiles',
Exemple #3
0
# Initialize django
import os.path
import exportrecipe
BUILDOUT_DIR = os.path.abspath(
    os.path.join(os.path.dirname(__file__), '../..')
)
config = exportrecipe.load(os.path.join(BUILDOUT_DIR, 'settings.json'))
os.environ['DJANGO_SETTINGS_MODULE'] = config.django_settings
import django
django.setup()


BOT_NAME = 'manoseimas.lt'

SPIDER_MODULES = ['manoseimas.scrapy.spiders']
NEWSPIDER_MODULE = 'manoseimas.scrapy.spiders'
DEFAULT_ITEM_CLASS = 'manoseimas.scrapy.items.Person'
USER_AGENT = '%s/1.1' % (BOT_NAME)

LOG_ENABLED = True
LOG_LEVEL = 'WARNING'  # CRITICAL, ERROR, WARNING, INFO, DEBUG
# LOG_FILE = os.path.join(settings.BUILDOUT_DIR, 'var', 'log', 'scrapy.log')

ITEM_PIPELINES = [
    'scrapy.contrib.pipeline.images.ImagesPipeline',
    'manoseimas.scrapy.pipelines.ManoseimasPipeline',
    'manoseimas.scrapy.pipelines.ManoSeimasModelPersistPipeline',
]

DOWNLOADER_MIDDLEWARES = {
    'manoseimas.scrapy.downloadermiddleware.NoCacheInitialURLMiddleware': 1
Exemple #4
0
"""
Django settings for akllt project.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

from pathlib import Path
from django.conf import global_settings as defaults

import exportrecipe

config = exportrecipe.load('settings.json')
PROJECT_DIR = Path(__file__).parents[2]

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6*s1ia-oxj80hhj#^agy#ml3%2b(=nt*m2b3#dz=^chnh_*3^9'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []
Exemple #5
0
"""
Django settings for akllt project.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""

from pathlib import Path
from django.conf import global_settings as defaults

import exportrecipe

config = exportrecipe.load('settings.json')
PROJECT_DIR = Path(__file__).parents[2]


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6*s1ia-oxj80hhj#^agy#ml3%2b(=nt*m2b3#dz=^chnh_*3^9'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []
Exemple #6
0
 def test_load_with_dashes(self):
     with mock.patch('exportrecipe.open',
                     mock.mock_open(read_data='{"option-name": "value"}'),
                     create=True):
         config = exportrecipe.load('settings.json')
     self.assertEqual(config.option_name, 'value')
Exemple #7
0
 def test_load_with_dashes(self):
     with mock.patch('exportrecipe.open', mock.mock_open(read_data='{"option-name": "value"}'), create=True):
         config = exportrecipe.load('settings.json')
     self.assertEqual(config.option_name, 'value')