dirrss allows you to browse directories in the form of rss streams. For each file an item is created with the file itself as an attachment. If you want to listen for new files in your folder, just point your favourite rss reader at the stream url.
Ok - sounds fine in theory, but what is it really good for? This project was developed as a companion to radioman, a project allowing you to schedule and record your favourite radio shows. If you place your recordings in your dirrss folder, you can create an rss stream from your recordings and download them to your listening device with a podcatcher. With dirrss listening to radio shows is just as easy as subscribing to a podcast.
If you already have a django project ready, clone this repository into your project and skip right to the settings section.
- install django from your favourite package repository
cd
to your desired destination path- create a django project to host the dirrss app
cd
into your newly created project and clone dirrss withgit clone https://github.com/niklasfi/dirrss.git
For dirrss to work properly, a few settings in your <project_name>/settings.py
have to be adjusted:
-
INSTALLED_APPS
dirrss needs the sites app. Adddjango.contrib.sites
anddirrss
to yourINSTALLED_APPS
. -
MEDIA_URL
configure a media url. This is the path clients direct requests at to download media files. A typical value is/media/
-
MEDIA_ROOT
configure the media root. This is the file system location at which your media files are located. A typical value isos.path.join(BASE_DIR, 'media')
-
DIRRSS_MEDIA_URL
path under which the media files to be served by dirrss are located. A typical value isMEDIA_URL + 'dirrss/'
. -
DIRRSS_MEDIA_ROOT
filesystem location at which the media files to be served by dirrss can be found. A typical value isos.path.join(MEDIA_ROOT, 'dirrss')
-
SITE_ID
after you have completed the step sites setup make sure to setSITE_ID
to the primary key of the site you want to use.
Create the directory specified in the DIRRSS_MEDIA_ROOT
setting. If you are using radioman to create your media files, configure its destinationPath to be the same as DIRRSS_MEDIA_ROOT
.
Delegate calls to /dirrss
to the dirrss app. Import include
with
from django.conf.urls import include
and add the line
url(r'^dirrss/', include('dirrss.urls')),
to your urlpatterns in <project_name>/urls.py
. If you want to use django's built in static file hosting, also add
urlpatterns += static(settings.DIRRSS_MEDIA_URL, document_root=settings.DIRRSS_MEDIA_ROOT)
to the file. For this to work, it may be necessary, first import static with
from django.conf.urls.static import static
In total, a minimal urls.py
may look something like this
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^dirrss/', include('dirrss.urls'))
] + static(settings.DIRRSS_MEDIA_URL, document_root=settings.DIRRSS_MEDIA_ROOT)
Of course, if you want the path to call dirrss to be something else, feel free to change it to your liking.
Create a django site to be used by dirrss to create absolute links to its media files. There are multiple ways to do so. You can use the admin site, for example. In this guide we are using the django shell.
Open the django shell with python manage.py shell
. In the shell execute an adjusted version of the following script. Set domain
and name
to appropriate values for your applications. If you want to host dirrss on a public server, you likely want domain
and name
to be the server's fully qualified domain name (e.g. example.com
). If you only want to host dirrss locally, you can leave domain
and name
as they are. They will point to the local server available trough python manage.py runserver
.
domain = 'localhost:8000'
name = 'localhost:8000'
from django.contrib.sites.models import Site
s = Site.objects.create(domain=domain, name=name)
print "SITE_ID = {}".format(s.pk)
Finally, tell the django project to use your site by adding the printed site id to your <project_name>/settings.py
file.
Start your local webserver with python manage.py runserver
and visit http://localhost:8000/dirrss/
or whatever url you have previously configures.