django-bootstrap-static | Bootstrap static content wrapped in a pip | Frontend Framework library
kandi X-RAY | django-bootstrap-static Summary
kandi X-RAY | django-bootstrap-static Summary
Bootstrap static content wrapped in a pip installable django package
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of django-bootstrap-static
django-bootstrap-static Key Features
django-bootstrap-static Examples and Code Snippets
Community Discussions
Trending Discussions on django-bootstrap-static
QUESTION
I recently started to work on a Django Bootstrap project and it started to become confusing. I installed the Django and created a project. Normally, it works as it should be and I'm able to display the app from my browser.
However, I wanted to personalise the template and decided to go with bootstrap4, which is a really cool framework. I installed bootstrap with this command "pip install django-bootstrap-static". I'm aware that I should include my static files in to the STATIC folder and specify it on to the settings.py, which I did, but I couldn't find the bootstrap4 files on the machine at the first place.
The thing is, I included the library references on the the html file like this;
...ANSWER
Answered 2018-Apr-08 at 15:27Let's start by taking a look at how Django's STATICFILES_FINDERS
works:
The default will find files stored in the STATICFILES_DIRS setting (using django.contrib.staticfiles.finders.FileSystemFinder) and in a static subdirectory of each app (using django.contrib.staticfiles.finders.AppDirectoriesFinder). If multiple files with the same name are present, the first file that is found will be used.
Note the line that it searches the static subdirectory of each app.
Now let's take a look at the folder structure of django-bootstrap-static
, we see two main folders bootstrap
and fontawesome
. And if you look inside, they only contain __init__.py
and a folder named static
.
Basically, both bootstrap
and fontawesome
can be seen as Django apps (i.e. similar to apps you create with python manage.py startapp
). By including bootstrap
and fontawesome
into your INSTALLED_APPS
, you've included them as apps in your own Django project and Django's STATICFILES_FINDERS
will look into these two apps too to look for folders named static
. So in this case it's able to find these static files and include it when you run python manage.py collectstatic
.
EDIT
I forgot to answer the part about SASS. To do so, I would probably use a library like django-sass-processor
and also create my own app called bootstrap
using the python manage.py startapp bootstrap
and create a folder called static
inside. Within the static
folder I would create my SASS folder structure and do my necessary overrides and personalisations.
Bonus: A nice way to architecture your SASS project can be found here
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-bootstrap-static
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page