Пример #1
0
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = location('public/media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    location('static/'),
] + ofp.get_oscar_fancypages_paths('static')

STATIC_ROOT = location('public')

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'sba9ti)x&^fkod-g91@^_yi6y_#&3mo#m5@n)i&k+0h=+zsfkb'

# List of callables that know how to import templates from various sources.
Пример #2
0
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = location('public/media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    location('static/'),
] + ofp.get_oscar_fancypages_paths('static')

STATIC_ROOT = location('public')

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'sba9ti)x&^fkod-g91@^_yi6y_#&3mo#m5@n)i&k+0h=+zsfkb'

# List of callables that know how to import templates from various sources.
def pytest_configure():
    SETTINGS = OSCAR_SETTINGS
    SETTINGS.update(FANCYPAGES_SETTINGS)

    settings.configure(
        DEBUG=True,
        DATABASES={
            'default': {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': ':memory:',
            }
        },
        MEDIA_ROOT=sandbox('public/media'),
        MEDIA_URL='/media/',
        STATIC_URL='/static/',
        STATICFILES_DIRS=[sandbox('static/')] +
        ofp_utils.get_oscar_fancypages_paths('static'),
        STATIC_ROOT=sandbox('public'),
        STATICFILES_FINDERS=(
            'django.contrib.staticfiles.finders.FileSystemFinder',
            'django.contrib.staticfiles.finders.AppDirectoriesFinder',
            'compressor.finders.CompressorFinder',
        ),
        TEMPLATE_LOADERS=(
            'django.template.loaders.filesystem.Loader',
            'django.template.loaders.app_directories.Loader',
        ),
        TEMPLATE_CONTEXT_PROCESSORS=(
            "django.contrib.auth.context_processors.auth",
            "django.core.context_processors.request",
            "django.core.context_processors.debug",
            "django.core.context_processors.i18n",
            "django.core.context_processors.media",
            "django.core.context_processors.static",
            "django.contrib.messages.context_processors.messages",
        ),
        MIDDLEWARE_CLASSES=(
            'django.middleware.common.CommonMiddleware',
            'django.contrib.sessions.middleware.SessionMiddleware',
            'django.middleware.csrf.CsrfViewMiddleware',
            'django.contrib.auth.middleware.AuthenticationMiddleware',
            'django.contrib.messages.middleware.MessageMiddleware',
            'fancypages.middleware.EditorMiddleware',
        ),
        ROOT_URLCONF='oscar_sandbox.sandbox.urls',
        TEMPLATE_DIRS=[
            sandbox('templates'),
            OSCAR_MAIN_TEMPLATE_DIR,
        ] + ofp_utils.get_oscar_fancypages_paths('templates'),
        INSTALLED_APPS=[
            'django.contrib.auth',
            'django.contrib.contenttypes',
            'django.contrib.sessions',
            'django.contrib.sites',
            'django.contrib.messages',
            'django.contrib.staticfiles',
            'django.contrib.admin',
            'model_utils',
            'compressor',
            'twitter_tag',
            'sorl.thumbnail',
            'rest_framework',
            'django_extensions',
        ] + ofp_utils.get_oscar_fancypages_apps() + get_core_apps(),
        AUTHENTICATION_BACKENDS=(
            'django.contrib.auth.backends.ModelBackend', ),
        HAYSTACK_CONNECTIONS={
            'default': {
                'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
            },
        },
        LOGIN_REDIRECT_URL='/accounts/',
        APPEND_SLASH=True,
        SITE_ID=1,
        **SETTINGS)
Пример #4
0
def pytest_configure():
    SETTINGS = OSCAR_SETTINGS
    SETTINGS.update(FANCYPAGES_SETTINGS)

    settings.configure(
        DEBUG=True,
        DATABASES={"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}},
        MEDIA_ROOT=sandbox("public/media"),
        MEDIA_URL="/media/",
        STATIC_URL="/static/",
        STATICFILES_DIRS=[sandbox("static/")] + ofp_utils.get_oscar_fancypages_paths("static"),
        STATIC_ROOT=sandbox("public"),
        STATICFILES_FINDERS=(
            "django.contrib.staticfiles.finders.FileSystemFinder",
            "django.contrib.staticfiles.finders.AppDirectoriesFinder",
            "compressor.finders.CompressorFinder",
        ),
        TEMPLATE_LOADERS=(
            "django.template.loaders.filesystem.Loader",
            "django.template.loaders.app_directories.Loader",
        ),
        TEMPLATE_CONTEXT_PROCESSORS=(
            "django.contrib.auth.context_processors.auth",
            "django.core.context_processors.request",
            "django.core.context_processors.debug",
            "django.core.context_processors.i18n",
            "django.core.context_processors.media",
            "django.core.context_processors.static",
            "django.contrib.messages.context_processors.messages",
        ),
        MIDDLEWARE_CLASSES=(
            "django.middleware.common.CommonMiddleware",
            "django.contrib.sessions.middleware.SessionMiddleware",
            "django.middleware.csrf.CsrfViewMiddleware",
            "django.contrib.auth.middleware.AuthenticationMiddleware",
            "django.contrib.messages.middleware.MessageMiddleware",
            "fancypages.middleware.EditorMiddleware",
        ),
        ROOT_URLCONF="oscar_sandbox.sandbox.urls",
        TEMPLATE_DIRS=[sandbox("templates"), OSCAR_MAIN_TEMPLATE_DIR]
        + ofp_utils.get_oscar_fancypages_paths("templates"),
        INSTALLED_APPS=[
            "django.contrib.auth",
            "django.contrib.contenttypes",
            "django.contrib.sessions",
            "django.contrib.sites",
            "django.contrib.messages",
            "django.contrib.staticfiles",
            "django.contrib.admin",
            "model_utils",
            "compressor",
            "twitter_tag",
            "sorl.thumbnail",
            "rest_framework",
            "django_extensions",
        ]
        + ofp_utils.get_oscar_fancypages_apps()
        + get_core_apps(),
        AUTHENTICATION_BACKENDS=("django.contrib.auth.backends.ModelBackend",),
        HAYSTACK_CONNECTIONS={"default": {"ENGINE": "haystack.backends.simple_backend.SimpleEngine"}},
        LOGIN_REDIRECT_URL="/accounts/",
        APPEND_SLASH=True,
        SITE_ID=1,
        **SETTINGS
    )
Пример #5
0
def configure():
    if not settings.configured:

        SETTINGS = OSCAR_SETTINGS
        SETTINGS.update(FANCYPAGES_SETTINGS)
        # now we are adding our own specific settings for the tests
        SETTINGS.update(dict(
            DATABASES={
                'default': {
                    'ENGINE': 'django.db.backends.sqlite3',
                    'NAME': ':memory:',
                }
            },
            MEDIA_ROOT=sandbox('public/media'),
            MEDIA_URL='/media/',
            STATIC_URL='/static/',
            STATICFILES_DIRS=[
                sandbox('static/'),
            ] + ofp_utils.get_oscar_fancypages_paths('static'),
            STATIC_ROOT=sandbox('public'),
            STATICFILES_FINDERS=(
                'django.contrib.staticfiles.finders.FileSystemFinder',
                'django.contrib.staticfiles.finders.AppDirectoriesFinder',
                'compressor.finders.CompressorFinder',
            ),
            TEMPLATE_LOADERS=(
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
            ),
            TEMPLATE_CONTEXT_PROCESSORS = (
                "django.contrib.auth.context_processors.auth",
                "django.core.context_processors.request",
                "django.core.context_processors.debug",
                "django.core.context_processors.i18n",
                "django.core.context_processors.media",
                "django.core.context_processors.static",
                "django.contrib.messages.context_processors.messages",
            ),
            MIDDLEWARE_CLASSES=(
                'django.middleware.common.CommonMiddleware',
                'django.contrib.sessions.middleware.SessionMiddleware',
                'django.middleware.csrf.CsrfViewMiddleware',
                'django.contrib.auth.middleware.AuthenticationMiddleware',
                'django.contrib.messages.middleware.MessageMiddleware',
                'debug_toolbar.middleware.DebugToolbarMiddleware',
                'fancypages.middleware.EditorMiddleware',
            ),
            ROOT_URLCONF='sandbox.sandbox.urls',
            TEMPLATE_DIRS=[
                sandbox('templates'),
                OSCAR_MAIN_TEMPLATE_DIR,
            ] + ofp_utils.get_oscar_fancypages_paths('templates'),
            INSTALLED_APPS=(
                'django.contrib.auth',
                'django.contrib.contenttypes',
                'django.contrib.sessions',
                'django.contrib.sites',
                'django.contrib.messages',
                'django.contrib.staticfiles',
                'django.contrib.admin',

                'model_utils',
                'compressor',
                'twitter_tag',
                'sorl.thumbnail',
                'rest_framework',
            ) + ofp_utils.get_oscar_fancypages_apps() + tuple(get_core_apps([])),
            AUTHENTICATION_BACKENDS=(
                'django.contrib.auth.backends.ModelBackend',
            ),
            HAYSTACK_CONNECTIONS={
                'default': {
                    'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
                },
            },
            LOGIN_REDIRECT_URL='/accounts/',
            APPEND_SLASH=True,
            NOSE_ARGS=[
                '-s',
                '--with-specplugin',
            ],
        ))
        settings.configure(**SETTINGS)