Search code examples
pythonangularjsdjangocordovameanjs

Serving static index.html in django


Thing is, I have an angular + cordova app on one module. I just want the REST api from django for the webserver. no views or anything (well only to serve the angular views).

How can I serve the static index.html using django? do I need different project structure? I'm a newbie to django.

Thanks in advance!

This is driving me nuts.


Solution

  • You can use TemplateView directly:

    from django.views.generic import TemplateView
    
    ...
    url(r'^$', TemplateView.as_view(template_name='index.html'))
    

    Remember you need to configure your templates folder to call .html files by name only.