awesto/cookiecutter-django-shop

Error: File to import not found or unreadable: shop/css/variables.

Opened this issue · 0 comments

ljfp commented

What happened?

When running a server after a fresh install and navigating to http://127.0.0.1:8000/en/ in my browser I see the following error:

Error: File to import not found or unreadable: shop/css/variables.
on line 1:1 of myshop/static/myshop/css/_variables.scss
from line 1:1 of myshop/static/myshop/css/default.scss

https://github.com/import "shop/css/variables";

What should've happened instead?

I should have seen the login page.

Steps to reproduce

I'll add here the steps I take to reproduce it, with the full console logs:


ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)
Collecting pip
Downloading pip-24.0-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 10.6 MB/s eta 0:00:00
Installing collected packages: pip
Successfully installed pip-24.0


ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ python -m venv env


ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ source env/bin/activate


(env) ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ export DJANGO_DEBUG=1


(env) ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ pipenv install
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (2e81f4)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.


(env) ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ npm install

up to date, audited 262 packages in 4s

8 packages are looking for funding
run npm fund for details

11 vulnerabilities (5 moderate, 6 high)

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.


(env) ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ ./manage.py initialize_shop_demo
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django_fsm/init.py:63: UserWarning: The 'django-fsm' package has been integrated into 'viewflow' as 'viewflow.fsm' starting from version 3.0. This version of 'django-fsm' is no longer maintained and will not receive further updates. If you require new functionality introduced in 'django-fsm' version 3.0 or later, please migrate to 'viewflow.fsm'. For detailed instructions on the migration process and accessing new features, refer to the official documentation at https://docs.viewflow.io/fsm/index.html
show_deprecation_warning()
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/shop/apps.py:32: UserWarning:
Your caching backend does not support invalidation by key pattern.
Please use django-redis-cache, or wait until the product's HTML
snippet cache expires by itself.
warnings.warn("\n"
Operations to perform:
Apply all migrations: admin, auth, authtoken, cms, cmsplugin_cascade, contenttypes, djangocms_text_ckeditor, easy_thumbnails, email_auth, filer, menus, myshop, post_office, sessions, shop, shop_sendcloud, sites
Running migrations:
No migrations to apply.
Project myshop already initialized
Operations to perform:
Apply all migrations: admin, auth, authtoken, cms, cmsplugin_cascade, contenttypes, djangocms_text_ckeditor, easy_thumbnails, email_auth, filer, menus, myshop, post_office, sessions, shop, shop_sendcloud, sites
Running migrations:
No migrations to apply.


(env) ljfp@pop-os:~/Repositories/cookiecutter-django-shop/my-shop$ ./manage.py runserver
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django_fsm/init.py:63: UserWarning: The 'django-fsm' package has been integrated into 'viewflow' as 'viewflow.fsm' starting from version 3.0. This version of 'django-fsm' is no longer maintained and will not receive further updates. If you require new functionality introduced in 'django-fsm' version 3.0 or later, please migrate to 'viewflow.fsm'. For detailed instructions on the migration process and accessing new features, refer to the official documentation at https://docs.viewflow.io/fsm/index.html
show_deprecation_warning()
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/shop/apps.py:32: UserWarning:
Your caching backend does not support invalidation by key pattern.
Please use django-redis-cache, or wait until the product's HTML
snippet cache expires by itself.
warnings.warn("\n"
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django_fsm/init.py:63: UserWarning: The 'django-fsm' package has been integrated into 'viewflow' as 'viewflow.fsm' starting from version 3.0. This version of 'django-fsm' is no longer maintained and will not receive further updates. If you require new functionality introduced in 'django-fsm' version 3.0 or later, please migrate to 'viewflow.fsm'. For detailed instructions on the migration process and accessing new features, refer to the official documentation at https://docs.viewflow.io/fsm/index.html
show_deprecation_warning()
/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/shop/apps.py:32: UserWarning:
Your caching backend does not support invalidation by key pattern.
Please use django-redis-cache, or wait until the product's HTML
snippet cache expires by itself.
warnings.warn("\n"
[2024-05-06 01:17:20,417 autoreload] INFO: Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (1 silenced).
May 06, 2024 - 01:17:20
Django version 3.0.14, using settings 'myshop.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.


So far it seems to be working but once I open a browser and try to navigate to http://127.0.0.1:8000/ I see the following error:

[2024-05-06 01:17:24,873 basehttp] INFO: "GET / HTTP/1.1" 302 0
[2024-05-06 01:17:25,058 log] ERROR: Internal Server Error: /en/
Traceback (most recent call last):
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 145, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 143, in _get_response
response = response.render()
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/response.py", line 105, in render
self.content = self.rendered_content
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/response.py", line 83, in rendered_content
return template.render(context, self._request)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 171, in render
return self._render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/loader_tags.py", line 150, in render
return compiled_parent._render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 163, in _render
return self.nodelist.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sekizai/templatetags/sekizai_tags.py", line 70, in render
return super().render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/classytags/core.py", line 151, in render
return str(self.render_tag(context, **kwargs))
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sekizai/templatetags/sekizai_tags.py", line 155, in render_tag
rendered_contents = nodelist.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 936, in render
bit = node.render_annotated(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/django/template/base.py", line 903, in render_annotated
return self.render(context)
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sass_processor/templatetags/sass_tags.py", line 35, in render
path = self.sass_processor(self.sass_processor.resolve_path(context))
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sass_processor/processor.py", line 90, in __call__
raise exc
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sass_processor/processor.py", line 84, in __call__
content, sourcemap = (force_bytes(output) for output in sass.compile(**compile_kwargs))
File "/home/ljfp/Repositories/cookiecutter-django-shop/my-shop/env/lib/python3.10/site-packages/sass.py", line 725, in compile
raise CompileError(v)
sass.CompileError: Error: File to import not found or unreadable: shop/css/variables.
on line 1:1 of myshop/static/myshop/css/_variables.scss
from line 1:1 of myshop/static/myshop/css/default.scss
>> @import "shop/css/variables";

^

[2024-05-06 01:17:25,063 basehttp] ERROR: "GET /en/ HTTP/1.1" 500 23717

EDIT:
I have django-sass-processor installed in my virtual environment, and it's included in the INSTALLED_APPS list in settings.py