diff --git a/Python/Django/BOOTSTRAP-INTEGRATION.md b/Python/Django/BOOTSTRAP-INTEGRATION.md new file mode 100644 index 0000000..167def2 --- /dev/null +++ b/Python/Django/BOOTSTRAP-INTEGRATION.md @@ -0,0 +1,59 @@ +# Django-Bootstrap Integration + +This document covers steps to integrate bootstrap in django. +This is to help new comers to easily integrate bootstrap in Django module including Django Admin. + +### Integration Steps + +- [Download Bootstrap](https://github.com/twbs/bootstrap/releases/download/v5.0.0-beta3/bootstrap-5.0.0-beta3-dist.zip) from here and extract the downloaded folder and you will get two folder named css and js. + +- Now create a folder name static in your created app and paste the above extracted folder in it. + +- Again create a folder named template inside the app and make file index.html and copy the given code to it +``` + + + + + Title + {% load staticfiles %} + + + + + + +``` + +- Now copy the below code in your setting.py +``` +STATIC_URL = '/static/' +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, 'app_name/static') +] +STATIC_ROOT = os.path.join(BASE_DIR, 'assets') +``` +Note: app_name will contain your application name. + +- After that run command ```python manage.py collectstatic``` to collect all your static file under assests directory. + +- Congratulation! you have integrated bootstrap in your django project. Now you only have to extends index.html in your templates to use bootstrap. + +### Additional Step for Django Admin + +- Integration with admin is almost same but in place of creating index.html follow the below instructions. + +- Create a folder named admin inside your template folder. +- Create a file name base_site.html and paste the below code +``` +{% extends 'admin/base_site.html' %} + +{% load static %} + +{% block extrastyle %} + + +{% endblock %} +``` + +- Now extend base_site.html in order to use bootstrap in your templates. \ No newline at end of file diff --git a/Python/Django/README.md b/Python/Django/README.md new file mode 100644 index 0000000..ddfe1b1 --- /dev/null +++ b/Python/Django/README.md @@ -0,0 +1,26 @@ +# Django + +This document covers the resources needed to learn Django. +They are designed in a way that a newcomer can easily know where to look for resources and links. + +### Prerequisites + +- Basic knowledge of Web technologies: HTML, CSS, and JavaScript. +- [Python](https://docs.python.org/3.9/tutorial/index.html) + +### Getting Started + +Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Checkout this [What is Django?](https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Introduction) to know more about this amazing technology. + + +Also have a look at:- +[What is MVT?](https://medium.com/@jaychaturvedi18/a-brief-introduction-to-django-mvt-framework-8ef46cc321ab) + +### Where Should I Start? + +You can start from the official website [tutorial](https://docs.djangoproject.com/en/3.2/). It's a great learning curve which covers all the basics of Django. + + +### Video Tutorials + +- You can also checkout [this](https://www.youtube.com/watch?v=OTmQOjsl0eg).