Bootstrap Django - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Bootstrap Django (/thread-41766.html) |
Bootstrap Django - Sowmya - Mar-16-2024 Hi all. I want to add nav bar to my Django project. So I copied Html code from Bootstrap to my Django Html. It worked properly. So, the Youtuber said don't use bootstrap css .They gave bootstrap css & js files . I loaded it in my Django folder , and I changed Django html file like {% load static %} <link rel="stylesheet" href="{% static 'css/bootstarp-grid.css' %}"> But I am not getting CSS style to my website. Please anyone can help to solve this issue. Thanks in advance for your support! RE: Bootstrap Django - tahirahmedd - May-20-2024 create a static folder and create another folder called css inside the static and paste your bootstrap file into css folder: static folder must be in the root folder of your project : like this: myproject/ └── myproject/ └── registration/ └── static/ └── templates/ ├── db.sqlite3 ├── manage.py Now change your static settings look like this: Now add the following codes to your settings.py file to set up the Django static files. STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') now in your head section: link your css file like this: <link href="static/css/bootstarp-grid.css" rel="stylesheet"> Hope it will work fine. for further more tutorial in detail you can check out my blog past as well or dm me: https://web-spidy.com/manage-django-static-files-images-javascript-css/ |