Django/SCSS: missing staticfiles manifest -> staticfiles.json with empty paths

489 views Asked by At

EDIT 05/02/2021 10:45

I still do not find any solution to my issue

reading other post show that there are many possible cause to this issue

If someone could help and explain me how django_compressor should work?

For example,

is it right that the manifest files is called staticfiles.json?

It is abnormal that this files contain no paths?

which paths it should contain? ...


EDIT 04/02/2021 14:00

I run

python manage.py findstatic --verbosity 2 theme.scss

and get (below), that mean that path is correct?

Found 'theme.scss' here:
  /usr/src/app/static/theme.scss
Looking in the following locations:
  /usr/src/app/static

EDIT 04/02/2021 13:38

I mentionned that with DEBUG = True and runserver it works

I mean I can customize bootstrap

and I can see staticfiles.json in /usr/src/app/static but this file contain no paths {"paths": {}, "version": "1.0"}


EDIT 04/02/2021 13:04

During running, logs mentionned

0 static files copied to '/usr/src/app/static'.
Found 'compress' tags in:
/usr/src/app/cafe/templates/cafe/table.html
...

But I've controlled in web container and static files are availables at /usr/src/app/static as expected (see docker-compose file)


I try to use SCSS in my Django project using django_compressor et django libsass

stack: Django/Nginx/Postgresql/Docker I have configured 2 environment of development: dev and preprod

I got an error: valueerror: missing staticfiles manifest entry for 'theme.scss'

I did not understand because it has worked bt I've tryed to delete container/images/volumes and rebuild all my project and got this error

I've tryed DEBUG = True, STATIC_ROOT = 'static'... but nothing works

logs only raise this error

settings -> preprod.py

- app
    - core
    - static
        - bootstrap
        - css
        - js
        - theme.scss
- nginx
DEBUG = False
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")


STATICFILES_FINDERS = [
    'compressor.finders.CompressorFinder',
]

COMPRESS_PRECOMPILERS = (
    ('text/x-scss', 'django_libsass.SassCompiler'),

COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True
LIBSASS_OUTPUT_STYLE = 'compressed'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
)

entrypoint.preprod.sh

python manage.py collectstatic --no-input
python manage.py compress --force

docker-compose.preprod.yml

version: '3.7'

services:
    web:
        restart: always
        container_name: web
        build: 
            context: ./app
            dockerfile: Dockerfile.preprod
        restart: always
        command: gunicorn core.wsgi:application --bind 0.0.0.0:8000
        volumes:
            - app_volume:/usr/src/app
            - static_volume:/usr/src/app/static
            - media_volume:/usr/src/app/media
        expose:
            - 8000
        env_file:
            - ./.env.preprod
        depends_on:
            - db
            - redis
        healthcheck:
            test: ["CMD", "curl", "-f", "http://localhost:8000/"]
            interval: 30s
            timeout: 10s
            retries: 50
            
    redis:
        container_name: redis
        image: "redis:alpine"

    celery:
        container_name: celery
        build: 
            context: ./app
            dockerfile: Dockerfile.preprod
        command: celery -A core worker -l info
        volumes:
            - app_volume:/usr/src/app
        env_file:
            - ./.env.preprod
        depends_on:
            db:
                condition: service_started
            web:
                condition: service_healthy
            redis:
                condition: service_started

    celery-beat:
        container_name: celery-beat
        build: 
            context: ./app
            dockerfile: Dockerfile.preprod
        command: celery -A core beat -l info
        volumes:
            - app_volume:/usr/src/app
        env_file:
            - ./.env.preprod
        depends_on:
            db:
                condition: service_started
            web:
                condition: service_healthy
            redis:
                condition: service_started
            
    db:
        container_name: db
        image: postgres:12.0-alpine
        volumes:
            - postgres_data:/var/lib/postgresql/data/
            - app_volume:/var/lib/postgresql/backup
        env_file:
            - ./.env.preprod.db
   
    nginx:
        container_name: nginx
        build: ./nginx
        restart: always
        volumes:
            - static_volume:/usr/src/app/static
            - media_volume:/usr/src/app/media
        ports:
            - 1340:80
        depends_on:
            web:
                condition: service_healthy

volumes:
    postgres_data:
    static_volume:
    media_volume:
    app_volume:

0

There are 0 answers