File to import not found or unreadable: bootstrap-sass - css

Trying out Django Shop. Following this tutorial: https://django-shop.readthedocs.io/en/stable/tutorial/intro.html (stable).
When I run the server and open localhost, here's what I see:
Error: File to import not found or unreadable: bootstrap-sass/assets/stylesheets/bootstrap/variables.
Parent style sheet: /home/vm/PycharmProjects/Django-shop/django-shop/shop/static/shop/css/_variables.scss
on line 1 of ../shop/static/shop/css/_variables.scss
>> #import "bootstrap-sass/assets/stylesheets/bootstrap/variables";
I presume, this "bootstrap-sass" directory is supposed to be in "css" and I don't see it there.
Only happens on front of the website. I can open admin panel just fine.

The error mentioned in the comment that says No module named 'django.core.urlresolvers' gives you a clue that there is a django compatibility issue. To understand more about this error please refer to this answer on Stackoverflow, which discusses a particular changelog from Django 1.x version to 2.x.
Now that we know that this could be a point of conflict here, refer to Compatibility Table, which clearly states that Django Shop is not compatible with Django 2.x versions as of now and in your project setup when you pip install django, it installs the latest version of django which is 2.1. Therefore to overcome this, you should downgrade the Django to a version thats compatible with your Django Shop version. So a working combination would be Django 1.11 and Django Shop 0.13.x.

Related

Bootstrap is wrong version in my rails project

I am going through a rails Udemy course, and we are using bootstrap. The instructor is on an older version and I started using the most recent version. Before long I discovered they are very different, so I wanted to switch to the correct version for the project. I have done gem uninstall gem bootstrap, and rails assets:clean, and went as far as to switch back to main and delete that git branch. I then updated the gemfile to install bootstrap 4.0.0, and ran bundle install. Gemfile lock reflects the changes. I then copied the instructors provided source files for the views we had been working on and the application.scss file. It has not worked. The scss in the rails app is being completely overridden by some trace of bootstrap 5.2. I know this because I inspected the page in the chrome dev console and in the sources there is this link which references the version.
/* line 1, ../../.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootstrap-5.2.0/assets/stylesheets/bootstrap/_root.scss */
I have restarted the rails server multiple times, but there is no effect. I have navigated to that folder in the rbenv directory and the bootstrap-4.0.0.alpha6 version is listed there, not the 5.2.0. However, the 5.2.0 version is persisting in what is on the browser. No changes that I make in the scss file have any effect. I tried changing all the colors to random ones, but none show up. There are no error messages to share. The CSS simply has no effect and appears to be overridden by this file that I cannot find anywhere in my rails project or on my system. Thank your for any guidance to fix this.
I found an answer.. I had to use rake assets:clobber to clear out precompiled files that had the bootstrap 5.2.0 in them. I did that and then rake assets:precompile and it instantly fixed it.

error deploying react project with font-awesome import

I'm trying to npm run deploy on my project where I'm storing the minified font-awesome css file and I'm getting the following error:
Creating an optimized production build...
Failed to compile.
./src/assets/css/font-awesome.all.min.css
ParserError: Syntax Error at line: 1, column 30
The app works fine on development sever.
The error shows whether I'm importing the css to the main css file or the main js file.
I only found some related old posts with potential solutions for a next.js project and yarn like in this link: https://github.com/vercel/next-plugins/issues/310
This is a react project and I'm using npm.
Any suggestions?
Can't comment on this unless there's more information regarding module-bundler and what is the configuration for the same. As it's treated differently according to module-bundler.
I would suggest you to use official package of fontawesome for react #fortawesome/react-fontawesome
PS. Module Bundler configuration should not be changed without proper knowledge as it can make whole application crash.

django admin not showing some css and form features

I copied my django (v1.10) source code to my Apache server, and executed the python manage.py collectstatic, it copied 420 files to /var/www/sitename/mainwork/static.
The website's css itself works fine, but the admin does not show some features!
.
It also does not show some links of the forms: (the first snapshot is the way it is supposed to be)
the way it supposed to be:
the way it is, with missing link:
what is causing this problem?
Thanks in advance. (if any code is required just tell me to add here)
Edit1:
This is the console errors related to the third snapshot:
There were different versions of django installed on the server (django 1.8 on apt-get and 1.10 on virtualenv!). and I think it caused a conflict on python manage.py collectstatic. (The website was running with django 1.10, but the admin's static files were from 1.8)
I removed the django 1.8, deleted the static/admin folder, and executed the collectstatic again. and the problem is resolved.

Don't show language code for default language in URL of Django CMS site

When I set up a multilingual DjangoCMS powered website the default language code is appended to the URL:
http://mypage.com/ -> http://mypage.com/en
I don't want this to be the case for the default language (e.g. 'en') Instead what I want is the default language being chosen when there's no language identifier within the URL:
http://mypage.com -> Choose English
http://mypage.com/fr -> Choose French
http://mypage.com/it -> Choose Italian
How can this be done?
Versions:
Django CMS 3.0.3
Django 1.6.5
Python 2.7
I wrote this for a project that's currently using it in production, they use django-cms 2.4.3 but I don't see why it would not work on 3.0, all you need to do is create middleware.py file in one of your apps, say core and then replace django's locale middleware with the path to this one, since it's a subclass of it.
I faced a similar situation for a web site based Django CMS version 3.4.5 and Django version 1.8.18. At first sight this seems to be a Django CMS concern, but later I realized this is more related with core Django, which has been natively addressed by the recent versions of this project.
A working solution
The straightforward solution I applied involved these changes:
Upgrade to Django version 1.11.8 (any version >= 1.10 should work). A shell command like pip install Django==1.11.8 --upgrade can achieve this.
Edit the urls.py file to change it like the following:
Original content of urls.py file:
urlpatterns += i18n_patterns(
url(r'^admin/', include(admin.site.urls)), # NOQA
url(r'^', include('cms.urls')),
)
New content of urls.py file:
urlpatterns += i18n_patterns(
url(r'^admin/', include(admin.site.urls)), # NOQA
url(r'^', include('cms.urls')),
prefix_default_language=False
)
Apply Django migrations, which are part of the new version of Django
Run again the Django project and visually verify the new desired behavior
I should mention that someone with the nick FalseID at the #django-cms IRC channel gave me the advice to find this solution, as well as other related tips.
Other references
Existing answer that applies to a general Django project https://stackoverflow.com/a/43911714/6693126 if the version of Django is >= 1.10. This describes a similar situation to mine.
For Django versions < 1.10, this answer is useful: https://stackoverflow.com/a/17517000/6693126 which is based on the django-solid-i18n-urls package. I have not tested this procedure, but it should work.

Javascript and CSS: resource not found or not accessible

I'm developing a couple of packages for plone 4.2. For some reason, when I install mypackage.blah through mypackage.policy, it loses access to its resourceDirectories, and its CSS and javascript are unavailable.
If I install mypackage.blah alone, it works fine. But I'm trying to install it using mypackage.policy, so I declared mypackage.blah as a dependency in setup.py and metadata.xml. When I install mypackage.policy, it install mypackage.blah, and its JS and CSS resources are registered, but portal_javascript they marked the files as "resource not found or innaccesible". It's as if it ignored the resourceDirectory directives.
What could be happening for resourceDirectory to be ignored?
Originally mypackage.policy used z3c.autoinclude, but I tried including mypackage.blah configuration directly in mypakcage.policy and even in buildout.cfg, and the problem persisted. There are no error traces in the log or console.
Any idea on how can I solve this problem?
Thanks in advance.
Did you upgrade collective.js.jqueryui? I did that and it REMOVED all other javascript!
I went into the ZMI->portal_CSS-> bundles (tab) and changed from 'jQueryUI' to 'default' in the 3 boxes. if it already is default, go to ZMI->portal_javacripts-> bundles (tab) and change 'jQueryUI' to 'default' in the 3 boxes.

Resources