0

My service implemented in Django is hosting iCal calendar files. I want this files to be opened as a webcal stream, but this requires URL to be composed in a certain way so that browser/system/another service understands what should it do to handle this file properly. The URL should look like this: webcal://myservice.com/icalfile, but the URL pattern in Django starts only at myservice.com base url, for example:

url(r'^/icalfile$', views.ReturnICS.as_view())

is the equivalent of:

myservice.com/icalfile

Although I can explicitly insert webcal:// to a url for each ical file represented in a template and pass it as variable when rendering view, like this for instance:

ics_url = 'webcal://' + icalfileurl

I'd very much like to find a way to compose a full url pattern that already has 'webcal://' part included, something like:

url(r'webcal://^*/icalfile$', views.ReturnICS.as_view())

* – is where base URL is. but Django does not recognise this construction.

Stan Reduta
  • 3,292
  • 5
  • 31
  • 55
  • This question doesn't really make sense. `webcal` is the protocol, it's not something that would be caught by Django's URL dispatcher. – Daniel Roseman Dec 02 '17 at 20:35
  • @DanielRoseman thanks for a good point, so you think it's a better practice to just adds static "webcal://" to a url and pass it as variable to template? – Stan Reduta Dec 02 '17 at 20:39

0 Answers0