Forking Django Oscar's static files doesn't work

I'm trying to fork default oscar's static. My folder structure is the following:

myproject/
    static/
        oscar/
    templates/
        flatpages/
        oscar/
    myproject/

And I set the following settings:

STATIC_URL = '/static/'

STATICFILES_DIRS = [
    BASE_DIR / 'static/'
]

Forking templates works just fine, but the same thing doesn't work with static, default files are still served in HTML. To fork static I used this command:

./manage.py oscar_fork_static

Any idea why is it so?

Add this inside templates in settings.py file

 'libraries' : {
                    'staticfiles': 'django.templatetags.static', 

EX:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
            'libraries' : {
                'staticfiles': 'django.templatetags.static', 
            }
        },
    },
]
                    }

See if this is helps you

Back to Top