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):
passCreate an audio recorder view using the AudioRecorderCreateViewMixin
from audio_recorder.views import AudioFileCreateViewMixin
class AudioFileCreateView(AudioFileCreateViewMixin):
model = AudioFileRegister 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.txtRun the development server
make serveRun lint & tests
make lint && make tests