<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def roughpage(request, url):
 """ Public interface to the rough page view. """

    if settings.APPEND_SLASH and not url.endswith('/'):
        # redirect to the url which have end slash
        return redirect(url + '/', permanent=True)
    # get base filename from url
    filename = url_to_filename(url)
    # try to find the template_filename with backends
    template_filenames = get_backend().prepare_filenames(filename,
                                                         request=request)
    # add extra prefix path
    root = settings.ROUGHPAGES_TEMPLATE_DIR
    template_filenames = [os.path.join(root, x) for x in template_filenames]
    try:
        t = loader.select_template(template_filenames)
        return render_roughpage(request, t)
    except TemplateDoesNotExist:
        if settings.ROUGHPAGES_RAISE_TEMPLATE_DOES_NOT_EXISTS:
            raise
        raise Http404