Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在django oscar中定制css文件使用更少的_Css_Django_Django Oscar - Fatal编程技术网

在django oscar中定制css文件使用更少的

在django oscar中定制css文件使用更少的,css,django,django-oscar,Css,Django,Django Oscar,我对django oscar还比较陌生,对网站前端只有基本的了解 我想更改django oscar中的样式.css。我曾尝试直接在style.css中进行更改,但在刷新localhost时,没有检测到任何更改(默认css) 我试图更改less文件,安装npm,安装less并将设置更改为OSCAR\u USE\u less=True。localhost甚至根本没有呈现css文件,只有模板 当我在根目录中编写命令makecss时,出现了以下错误,尽管我安装的更少 make: *** No rule

我对django oscar还比较陌生,对网站前端只有基本的了解

我想更改django oscar中的
样式.css
。我曾尝试直接在
style.css中进行更改,但在刷新localhost时,没有检测到任何更改(默认css)

我试图更改less文件,安装npm,安装less并将设置更改为
OSCAR\u USE\u less=True
。localhost甚至根本没有呈现css文件,只有模板

当我在根目录中编写命令
makecss
时,出现了以下错误,尽管我安装的更少

make: *** No rule to make target `css'.  Stop.
所以我真的不知道我的设置或安装的应用程序有什么问题

设置为

import os
import oscar

# Path helper - going into /Users/dion/Dev/dioncoffee/x
location = lambda x: os.path.join(
    os.path.dirname(os.path.dirname(os.path.realpath(__file__))), x)

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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=%*t%wzzw^hs5l2o@oq2ae-*&wde0bko4!hxl%=uqb$!5po$tt'

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

ALLOWED_HOSTS = []


# Application definition

from oscar import get_core_apps

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.flatpages',
    'django_extensions',

    'compressor',
    #'apps.gateway',     # For allowing dashboard access
    'widget_tweaks',
] + get_core_apps(
      ['apps.promotions']
      )

SITE_ID = 1

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'oscar.apps.basket.middleware.BasketMiddleware',
    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
]

ROOT_URLCONF = 'dioncoffee.urls'

from oscar import OSCAR_MAIN_TEMPLATE_DIR

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [            
            location('dioncoffee/templates'),
            oscar.OSCAR_MAIN_TEMPLATE_DIR,
            ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.i18n',
                'django.contrib.messages.context_processors.messages',

                'oscar.apps.search.context_processors.search_form',
                'oscar.apps.promotions.context_processors.promotions',
                'oscar.apps.checkout.context_processors.checkout',
                'oscar.apps.customer.notifications.context_processors.notifications',
                'oscar.core.context_processors.metadata',
            ],
        },
    },
]

WSGI_APPLICATION = 'dioncoffee.wsgi.application'

# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'dioncoffee',
        'USER': 'dion',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '',
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

AUTHENTICATION_BACKENDS = (
    'oscar.apps.customer.auth_backends.EmailBackend',
    'django.contrib.auth.backends.ModelBackend',
)

# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
    },
}

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = location("public/media")

STATIC_ROOT = location('public/static')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'

STATIC_URL = '/static/'

# /Users/dion/Dev/dioncoffee/static/
STATICFILES_DIRS = (
    location('static'),
)

from oscar.defaults import *

OSCAR_DEFAULT_CURRENCY = 'EUR'

OSCAR_CURRENCY_FORMAT = {
    'USD': {
        'currency_digits': False,
        'format_type': "accounting",
    },
    'EUR': {
        'format': u'#,##0\xa0¤',
    }
}

USE_LESS = True
COMPRESS_ENABLED = False
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
)
COMPRESS_OFFLINE_CONTEXT = {
'STATIC_URL': 'STATIC_URL',
'use_less': USE_LESS,
}
我的目录文件


我使用的是python 3.6.5。

制作css
仅用于Oscar本身的开发-它在您的项目中不起作用。但是,如果您处于调试模式,我不明白为什么
USE_LESS
方法会失败

也就是说,我认为您最好覆盖CSS,而不是依赖于
USE\u LESS
,后者在将来可能会被完全删除,并且只用于开发

如果放在正确的位置,您应该能够覆盖CSS

如果你的CSS在一个应用程序中,那么它需要进入
app\u dir/static/oscar/CSS/style.CSS
中,并且你需要在
staticfiles\u finders
设置中有
'django.contrib.staticfiles.finders.AppDirectoriesFinder'

或者,如果您有一个单独的静态文件目录,那么您需要在设置中包括
'django.contrib.staticfiles.finders.FileSystemFinder'
,还需要指定
staticfiles\u DIRS
来告诉django此目录的位置