Create a javascript audio recorder and save audio files using django.
# Install the latest version with
pip install git+https://github.com/voxy/django-audio-recorder.git#egg=django-audio-recorder
Add audio_recorder
to your installed apps in your django settings
INSTALLED_APPS = [
...
audio_recorder,
...
]
Create your model to store the audio file using a FileField.
from django.db import models
from audio_recorder.models import AudioFileMixin
class AudioFile(AudioFileMixin, models.Model):
pass
Create an audio recorder view using the AudioRecorderCreateViewMixin
from audio_recorder.views import AudioFileCreateViewMixin
class AudioFileCreateView(AudioFileCreateViewMixin):
model = AudioFile
Register the view in your urls
urlpatterns = [
url(r'audio-files/', AudioFileCreateView.as_view(create_field='audio_file'), name='audio-file-create')
]
Create a form and use the AudioFileWidget
for the audio recorder
from django import forms
from audio_recorder.widgets import AudioFileWidget
class AudioFileForm(forms.ModelForm):
class Meta:
model = AudioFile
widgets = {
'audio_file': AudioFileWidget(url='audio-file-create'),
}
Setup the environment
git clone https://github.com/voxy/django-audio-recorder.git
cd django-audio-recorder/test_project
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Run the development server
make serve
Run lint & tests
make lint && make tests