GithubHelp home page GithubHelp logo

esonderegger / django-podcast-host Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 21 KB

A simple Django project for hosting podcasts using Django Rest Framework

License: Apache License 2.0

Python 80.90% HTML 19.10%

django-podcast-host's Introduction

django-podcast-host

A simple Django project for hosting podcasts using Django REST framework

What it does

This project provides an API for creating podcasts, as well as the ability to consume the podcasts via an RSS feed or a (super-basic) web front-end. The aim of this project was to create a demo of a minimal useful API using Django REST framework, but it posed some interesting challenges:

  • using slugs instead of primary keys in URIs
  • authenticating users and controlling access
  • foreign key relationships
  • handling file uploads from users

How to install locally

Assuming you already have Python3 and the ability to create virtual environments installed, first clone this repository from github and cd into it:

git clone https://github.com/esonderegger/django-podcast-host.git
cd django-podcast-host

Then create a virtual environment for this project (I use the following commands, but there are several ways to get the desired result):

python3 -m venv ~/.virtualenvs/podcasthost
source ~/.virtualenvs/podcasthost/bin/activate

Next, install this project's dependencies

pip install -r requirements.txt

Then, make and run the required database migrations

python manage.py makemigrations
python manage.py migrate

Finally, run the development web server:

python manage.py runserver

How to use

If the local installation was successful, you should be able to go to http://localhost:8000/ and see a minimal web page. Click the "Sign up" link, and you will see a basic form. Enter a username and password according the instructions provided, and it should log you in and redirect you to http://localhost:8000/api/

Next, use the form fields (or curl or a REST client like Postman if you prefer) to enter data for a sample podcast and Click POST. You should see the JSON representation of the podcast you just created. Take note of the slug field. This is how you will access this podcast in future requests.

Next, go to http://localhost:8000/api/<podcast_slug>. You should see all of the form fields from the previous page, but with a PUT button for you to edit any of the fields in this entity and a DELETE button if you would like to delete this podcast.

Next, go to http://localhost:8000/api/<podcast_slug>/items. You should see an empty list and a set of form fields for creating a new episode for this podcast. Fill in the fields (note: enclosure is required) and click POST. Take note of the slug field returned in this response.

Next, go to go to http://localhost:8000/api/<podcast_slug>/<episode_slug>. You should see all of the form fields from the previous page, but with a PUT button for you to edit any of the fields in this entity and a DELETE button if you would like to delete this episode.

Finally, go to http://localhost:8000/api/<podcast_slug>/categories to edit the categories for this podcast. They should come from this list although this project does not enforce this presently. For example, to list the podcast as being in the "Government & Organizations -> Non-Profit" category, enter "Non-Profit" for name and "Government & Organizations" for parent_name. and click Post.

Now, you should be able to go to http://localhost:8000/ and see your new podcast listed. Click on its link and you should be taken to http://localhost:8000/<podcast_slug>. If you view the source code for the page, you should see something like <link rel="alternate" type="application/rss+xml" title="<Podcast title>" href="http://localhost:8000/<podcast_slug>/feed.xml"> in the head tag. If you download the feed from http://localhost:8000/<podcast_slug>/feed.xml and open it in an xml/rss reader, you should see the RSS representation of your podcast.

TODOs

  • Limit categories to only the ones allowed by iTunes. Ideally this category list would live in a database that is only editable by an admin user. This could require getting a many to many relationship to work. It might also be possible to do this with a MultipleChoiceField.
  • use ffprobe to get duration and type information from uploaded enclosures
  • use ffmpeg to re-encode uploaded media according to recommended specifications. Both this and using ffprobe would require having non-python dependencies and would also need to work asynchronously after the uploaded file has been saved.
  • make better front-ends for everything
  • improve the sign-up/login flow
  • improve error handling for unauthenticated podcast creation
  • use Django forms to create front-end for creating/editing podcasts
  • write tests

django-podcast-host's People

Contributors

esonderegger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.