django serving static files

In order to serve static files, you need to configure  In this example, say we are hosting our static files under a folder called 'static' (and app) with a filename called index.html.

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['static', 'app'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [

And finally set your "" 

from django.conf.urls import url
from django.views.generic.base import TemplateView

urlpatterns = [
    #url(r'^$', views.index, name='index2'),
    url(r'^$', TemplateView.as_view(template_name='index.html')),

Please note : You should always use default web server to serve static files. The code above is best used for development purposes only.


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

OpenCover code coverage for .Net Core

A quick tutorial for OWASP ZAP tool for beginners