It is a digital scrum board which is built using Django and Angular. This project is basically to understand how to integrate two frameworks and build a website
- python3 -m venv djangular
- cd djangular
- .\scripts\activate
- pip3 install django
- django-admin startproject djangular
- python3 -m venv djangular
- cd djangular
- .\bin\activate
- pip3 install django
- django-admin.py startproject djangular
-
build angular application: ng build --prod --output-path ../../djangular/scrumboard/static/ --watch --output-hashing none or normal prod build
-
copy the index.html to templates folder in 'startapp'
-
add below lines in setting.py
PROJECT_ROOT = os.path.dirname(os.path.abspath(file)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles') #never keep STATIC_ROOT and STATICFILES_DIRS same path as while runserver is executed it copies the static data from STATICFILES_DIRS to STATIC_ROOT path
STATIC_URL = '/static/'
#Extra places for collectstatic to find static files. STATICFILES_DIRS = (os.path.join(PROJECT_ROOT, 'static'),)
-
run command python manage.py collectstatic
-
changes in index.html file:
- add this at the top {% load static %}
- change the href and src to this format "{% static 'runtime.js' %}"
-
add path(r'^',TemplateView.as_view(template_name="index.html")) in urls.py of 'startapp' and add url(r'^',include('scrumboard.urls')) in url.py of the application