Update to Django 1.11 and Celery 4.2.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 28 Feb 2019 11:20:18 +0000 (12:20 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 28 Feb 2019 11:20:18 +0000 (12:20 +0100)
Move to Redis broker by default, since support for ORM broker is sketchy now.

23 files changed:
requirements.txt
src/archive/forms.py
src/archive/migrations/0001_initial.py
src/archive/migrations/0002_auto__del_field_audiobook_publishing_tags__del_field_audiobook_publish.py [deleted file]
src/archive/migrations/0003_auto__add_field_audiobook_source_sha1__add_field_audiobook_translator.py [deleted file]
src/archive/migrations/0004_auto__chg_field_audiobook_source_file.py [deleted file]
src/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py [deleted file]
src/archive/settings.py
src/archive/tasks.py
src/archive/templates/archive/base.html
src/archive/templates/archive/list_new.html
src/archive/templates/archive/list_publishing.html
src/archive/templates/archive/list_unmanaged.html
src/archive/templates/base.html
src/archive/urls.py
src/archive/utils.py
src/archive/views.py
src/audiobooks/__init__.py
src/audiobooks/celery.py [new file with mode: 0644]
src/audiobooks/settings.py
src/audiobooks/urls.py
src/audiobooks/wsgi.py
src/manage.py

index 90ae1d3..6f60425 100644 (file)
@@ -1,13 +1,14 @@
 -i https://py.mdrn.pl:8443/simple
 
 -i https://py.mdrn.pl:8443/simple
 
-django>=1.5,<1.6
-django-jsonfield==0.9.10
-South>=0.7
+django>=1.11,<2.0
+jsonfield==2.0.2
 django-cas==2.1.1.1
 
 django-cas==2.1.1.1
 
-django-celery
-django-kombu
+celery[redis]==4.2
+kombu
+redis
+vine
 
 paramiko>=1.7.7.1 # fabric dependency with http://code.fabfile.org/issues/show/214 fixed
 
 paramiko>=1.7.7.1 # fabric dependency with http://code.fabfile.org/issues/show/214 fixed
-fabric>=1.0
+fabric>=1.0,<2
 mutagen
 mutagen
index 81568c6..ad03308 100644 (file)
@@ -14,6 +14,7 @@ from archive.utils import ExistingFile, sha1_file
 class AudiobookForm(forms.ModelForm):
     class Meta:
         model = Audiobook
 class AudiobookForm(forms.ModelForm):
     class Meta:
         model = Audiobook
+        exclude = []
 
     def save(self, commit=True, path=None):
         """ Performs normal save, with given file as an source audiobook.
 
     def save(self, commit=True, path=None):
         """ Performs normal save, with given file as an source audiobook.
index ac5a2c9..cc10a9f 100644 (file)
@@ -1,80 +1,73 @@
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
 
 
-class Migration(SchemaMigration):
+from django.db import models, migrations
+import archive.utils
+import jsonfield.fields
+import archive.models
 
 
-    def forwards(self, orm):
-        
-        # Adding model 'Project'
-        db.create_table('archive_project', (
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=128, db_index=True)),
-            ('sponsors', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
-        ))
-        db.send_create_signal('archive', ['Project'])
 
 
-        # Adding model 'Audiobook'
-        db.create_table('archive_audiobook', (
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('source_file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
-            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
-            ('artist', self.gf('django.db.models.fields.CharField')(max_length=255)),
-            ('conductor', self.gf('django.db.models.fields.CharField')(max_length=255)),
-            ('encoded_by', self.gf('django.db.models.fields.CharField')(max_length=255)),
-            ('date', self.gf('django.db.models.fields.CharField')(max_length=255)),
-            ('project', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['archive.Project'])),
-            ('url', self.gf('django.db.models.fields.URLField')(max_length=255)),
-            ('modified', self.gf('django.db.models.fields.DateTimeField')(null=True)),
-            ('published_tags', self.gf('jsonfield.fields.JSONField')(null=True)),
-            ('mp3_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)),
-            ('ogg_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True)),
-            ('publishing_tags', self.gf('jsonfield.fields.JSONField')(null=True)),
-            ('publish_wait', self.gf('django.db.models.fields.DateTimeField')(null=True)),
-            ('publishing', self.gf('django.db.models.fields.BooleanField')(default=False)),
-            ('published', self.gf('django.db.models.fields.DateTimeField')(null=True)),
-        ))
-        db.send_create_signal('archive', ['Audiobook'])
+class Migration(migrations.Migration):
 
 
+    dependencies = [
+    ]
 
 
-    def backwards(self, orm):
-        
-        # Deleting model 'Project'
-        db.delete_table('archive_project')
-
-        # Deleting model 'Audiobook'
-        db.delete_table('archive_audiobook')
-
-
-    models = {
-        'archive.audiobook': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'},
-            'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
-            'publish_wait': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'publishing': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
-            'publishing_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
-        },
-        'archive.project': {
-            'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
-            'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
-        }
-    }
-
-    complete_apps = ['archive']
+    operations = [
+        migrations.CreateModel(
+            name='Audiobook',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('source_file', models.FileField(verbose_name='source file', max_length=255, editable=False, upload_to=archive.models.source_upload_to)),
+                ('source_sha1', models.CharField(max_length=40, editable=False)),
+                ('title', models.CharField(max_length=255, verbose_name='title')),
+                ('part_name', models.CharField(default=b'', help_text='eg. chapter in a novel', max_length=255, verbose_name='part name', blank=True)),
+                ('index', models.IntegerField(default=0, verbose_name='index')),
+                ('parts_count', models.IntegerField(default=1, verbose_name='parts count')),
+                ('artist', models.CharField(max_length=255, verbose_name='artist')),
+                ('conductor', models.CharField(max_length=255, verbose_name='conductor')),
+                ('encoded_by', models.CharField(max_length=255, verbose_name='encoded by')),
+                ('date', models.CharField(max_length=255, verbose_name='date')),
+                ('url', models.URLField(max_length=255, verbose_name='book url')),
+                ('translator', models.CharField(max_length=255, null=True, verbose_name='translator', blank=True)),
+                ('modified', models.DateTimeField(null=True, editable=False)),
+                ('mp3_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
+                ('mp3_task', models.CharField(max_length=64, null=True, editable=False)),
+                ('mp3_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+                ('mp3_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+                ('mp3_published_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+                ('mp3_published', models.DateTimeField(null=True, editable=False)),
+                ('ogg_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
+                ('ogg_task', models.CharField(max_length=64, null=True, editable=False)),
+                ('ogg_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+                ('ogg_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+                ('ogg_published_tags', jsonfield.fields.JSONField(null=True, editable=False)),
+                ('ogg_published', models.DateTimeField(null=True, editable=False)),
+            ],
+            options={
+                'ordering': ('title',),
+                'verbose_name': 'audiobook',
+                'verbose_name_plural': 'audiobooks',
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='Project',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(unique=True, max_length=128, verbose_name=b'Nazwa', db_index=True)),
+                ('sponsors', models.TextField(null=True, verbose_name=b'Sponsorzy', blank=True)),
+            ],
+            options={
+                'ordering': ('name',),
+                'verbose_name': 'project',
+                'verbose_name_plural': 'projects',
+            },
+            bases=(models.Model,),
+        ),
+        migrations.AddField(
+            model_name='audiobook',
+            name='project',
+            field=models.ForeignKey(verbose_name='project', to='archive.Project'),
+            preserve_default=True,
+        ),
+    ]
diff --git a/src/archive/migrations/0002_auto__del_field_audiobook_publishing_tags__del_field_audiobook_publish.py b/src/archive/migrations/0002_auto__del_field_audiobook_publishing_tags__del_field_audiobook_publish.py
deleted file mode 100644 (file)
index 03cb130..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        
-        # Deleting field 'Audiobook.publishing_tags'
-        db.delete_column('archive_audiobook', 'publishing_tags')
-
-        # Deleting field 'Audiobook.published_tags'
-        db.delete_column('archive_audiobook', 'published_tags')
-
-        # Deleting field 'Audiobook.publish_wait'
-        db.delete_column('archive_audiobook', 'publish_wait')
-
-        # Deleting field 'Audiobook.published'
-        db.delete_column('archive_audiobook', 'published')
-
-        # Deleting field 'Audiobook.publishing'
-        db.delete_column('archive_audiobook', 'publishing')
-
-        # Adding field 'Audiobook.mp3_status'
-        db.add_column('archive_audiobook', 'mp3_status', self.gf('django.db.models.fields.SmallIntegerField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.mp3_task'
-        db.add_column('archive_audiobook', 'mp3_task', self.gf('django.db.models.fields.CharField')(max_length=64, null=True), keep_default=False)
-
-        # Adding field 'Audiobook.mp3_tags'
-        db.add_column('archive_audiobook', 'mp3_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.mp3_published_tags'
-        db.add_column('archive_audiobook', 'mp3_published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.mp3_published'
-        db.add_column('archive_audiobook', 'mp3_published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.ogg_status'
-        db.add_column('archive_audiobook', 'ogg_status', self.gf('django.db.models.fields.SmallIntegerField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.ogg_task'
-        db.add_column('archive_audiobook', 'ogg_task', self.gf('django.db.models.fields.CharField')(max_length=64, null=True), keep_default=False)
-
-        # Adding field 'Audiobook.ogg_tags'
-        db.add_column('archive_audiobook', 'ogg_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.ogg_published_tags'
-        db.add_column('archive_audiobook', 'ogg_published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.ogg_published'
-        db.add_column('archive_audiobook', 'ogg_published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
-
-    def backwards(self, orm):
-        
-        # Adding field 'Audiobook.publishing_tags'
-        db.add_column('archive_audiobook', 'publishing_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.published_tags'
-        db.add_column('archive_audiobook', 'published_tags', self.gf('jsonfield.fields.JSONField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.publish_wait'
-        db.add_column('archive_audiobook', 'publish_wait', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.published'
-        db.add_column('archive_audiobook', 'published', self.gf('django.db.models.fields.DateTimeField')(null=True), keep_default=False)
-
-        # Adding field 'Audiobook.publishing'
-        db.add_column('archive_audiobook', 'publishing', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
-
-        # Deleting field 'Audiobook.mp3_status'
-        db.delete_column('archive_audiobook', 'mp3_status')
-
-        # Deleting field 'Audiobook.mp3_task'
-        db.delete_column('archive_audiobook', 'mp3_task')
-
-        # Deleting field 'Audiobook.mp3_tags'
-        db.delete_column('archive_audiobook', 'mp3_tags')
-
-        # Deleting field 'Audiobook.mp3_published_tags'
-        db.delete_column('archive_audiobook', 'mp3_published_tags')
-
-        # Deleting field 'Audiobook.mp3_published'
-        db.delete_column('archive_audiobook', 'mp3_published')
-
-        # Deleting field 'Audiobook.ogg_status'
-        db.delete_column('archive_audiobook', 'ogg_status')
-
-        # Deleting field 'Audiobook.ogg_task'
-        db.delete_column('archive_audiobook', 'ogg_task')
-
-        # Deleting field 'Audiobook.ogg_tags'
-        db.delete_column('archive_audiobook', 'ogg_tags')
-
-        # Deleting field 'Audiobook.ogg_published_tags'
-        db.delete_column('archive_audiobook', 'ogg_published_tags')
-
-        # Deleting field 'Audiobook.ogg_published'
-        db.delete_column('archive_audiobook', 'ogg_published')
-
-
-    models = {
-        'archive.audiobook': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'},
-            'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'mp3_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'mp3_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'ogg_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'ogg_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'ogg_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
-            'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
-        },
-        'archive.project': {
-            'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
-            'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
-        }
-    }
-
-    complete_apps = ['archive']
diff --git a/src/archive/migrations/0003_auto__add_field_audiobook_source_sha1__add_field_audiobook_translator.py b/src/archive/migrations/0003_auto__add_field_audiobook_source_sha1__add_field_audiobook_translator.py
deleted file mode 100644 (file)
index 9711b72..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# encoding: utf-8
-import datetime
-from hashlib import sha1
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-def sha1_file(f):
-    sha = sha1()
-    for piece in iter(lambda: f.read(1024*1024), ''):
-        sha.update(piece)
-    return sha.hexdigest()
-
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        
-        # Adding field 'Audiobook.source_sha1'
-        db.add_column('archive_audiobook', 'source_sha1', self.gf('django.db.models.fields.CharField')(default='', max_length=40), keep_default=False)
-
-        # Adding field 'Audiobook.translator'
-        db.add_column('archive_audiobook', 'translator', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True), keep_default=False)
-
-        if not db.dry_run:
-            for obj in orm.Audiobook.objects.all():
-                try:
-                    f = open(obj.source_file.path)
-                except ValueError, e:
-                    print "Audiobook has no source file"
-                    pass
-                else:
-                    obj.source_sha1 = sha1_file(f)
-                    f.close()
-                    obj.save()
-
-
-    def backwards(self, orm):
-        
-        # Deleting field 'Audiobook.source_sha1'
-        db.delete_column('archive_audiobook', 'source_sha1')
-
-        # Deleting field 'Audiobook.translator'
-        db.delete_column('archive_audiobook', 'translator')
-
-
-    models = {
-        'archive.audiobook': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'},
-            'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'mp3_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'mp3_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'ogg_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'ogg_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'ogg_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
-            'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
-            'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'translator': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
-            'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
-        },
-        'archive.project': {
-            'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
-            'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
-        }
-    }
-
-    complete_apps = ['archive']
diff --git a/src/archive/migrations/0004_auto__chg_field_audiobook_source_file.py b/src/archive/migrations/0004_auto__chg_field_audiobook_source_file.py
deleted file mode 100644 (file)
index 95d630e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        
-        # Changing field 'Audiobook.source_file'
-        db.alter_column('archive_audiobook', 'source_file', self.gf('django.db.models.fields.files.FileField')(max_length=255))
-
-
-    def backwards(self, orm):
-        
-        # Changing field 'Audiobook.source_file'
-        db.alter_column('archive_audiobook', 'source_file', self.gf('django.db.models.fields.files.FileField')(max_length=100))
-
-
-    models = {
-        'archive.audiobook': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'},
-            'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'mp3_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'mp3_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'ogg_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'ogg_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'ogg_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['archive.Project']"}),
-            'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
-            'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'translator': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
-            'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
-        },
-        'archive.project': {
-            'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
-            'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
-        }
-    }
-
-    complete_apps = ['archive']
diff --git a/src/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py b/src/archive/migrations/0005_auto__add_field_audiobook_part_name__add_field_audiobook_index__add_fi.py
deleted file mode 100644 (file)
index c163971..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- coding: utf-8 -*-
-from south.utils import datetime_utils as datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
-    def forwards(self, orm):
-        # Adding field 'Audiobook.part_name'
-        db.add_column(u'archive_audiobook', 'part_name',
-                      self.gf('django.db.models.fields.CharField')(default='', max_length=255, blank=True),
-                      keep_default=False)
-
-        # Adding field 'Audiobook.index'
-        db.add_column(u'archive_audiobook', 'index',
-                      self.gf('django.db.models.fields.IntegerField')(default=0),
-                      keep_default=False)
-
-        # Adding field 'Audiobook.parts_count'
-        db.add_column(u'archive_audiobook', 'parts_count',
-                      self.gf('django.db.models.fields.IntegerField')(default=1),
-                      keep_default=False)
-
-
-    def backwards(self, orm):
-        # Deleting field 'Audiobook.part_name'
-        db.delete_column(u'archive_audiobook', 'part_name')
-
-        # Deleting field 'Audiobook.index'
-        db.delete_column(u'archive_audiobook', 'index')
-
-        # Deleting field 'Audiobook.parts_count'
-        db.delete_column(u'archive_audiobook', 'parts_count')
-
-
-    models = {
-        u'archive.audiobook': {
-            'Meta': {'ordering': "('title',)", 'object_name': 'Audiobook'},
-            'artist': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'conductor': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'date': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'encoded_by': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'index': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
-            'modified': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'mp3_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'mp3_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'mp3_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'mp3_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True'}),
-            'ogg_published': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
-            'ogg_published_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_status': ('django.db.models.fields.SmallIntegerField', [], {'null': 'True'}),
-            'ogg_tags': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
-            'ogg_task': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
-            'part_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}),
-            'parts_count': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
-            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['archive.Project']"}),
-            'source_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
-            'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
-            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
-            'translator': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
-            'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
-        },
-        u'archive.project': {
-            'Meta': {'ordering': "('name',)", 'object_name': 'Project'},
-            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
-            'sponsors': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
-        }
-    }
-
-    complete_apps = ['archive']
\ No newline at end of file
index 476f6c7..38dc2a3 100644 (file)
@@ -17,8 +17,9 @@ except AttributeError:
     FILES_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
                         "archive/files"))
 
     FILES_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
                         "archive/files"))
 
-if FILES_PATH.startswith(settings.MEDIA_ROOT):
-    FILES_SAVE_PATH = FILES_PATH[len(settings.MEDIA_ROOT):].lstrip('/')
+_media_root = os.path.abspath(settings.MEDIA_ROOT)
+if FILES_PATH.startswith(_media_root):
+    FILES_SAVE_PATH = FILES_PATH[len(_media_root):].lstrip('/')
 
 
 # here the app keeps the unmanaged (archive) files
 
 
 # here the app keeps the unmanaged (archive) files
index a46b79c..be0eb1a 100644 (file)
@@ -96,7 +96,7 @@ class AudioFormatTask(Task):
             else:
                 api.run(command)
             disconnect_all()
             else:
                 api.run(command)
             disconnect_all()
-        except SystemExit, e:
+        except SystemExit as e:
             raise cls.RemoteOperationError
 
     def run(self, aid, publish=True):
             raise cls.RemoteOperationError
 
     def run(self, aid, publish=True):
index 8ec34e9..281779b 100644 (file)
@@ -2,11 +2,11 @@
 {% load i18n %}
 
 {% block repo-zones-nav %}
 {% load i18n %}
 
 {% block repo-zones-nav %}
-    <a {% if division = "new" %}class="active" {% endif %}href="{% url 'list_new' %}">{% trans "New" %}</a>
-    <a {% if division = "unpublished" %}class="active" {% endif %}href="{% url 'list_unpublished' %}">{% trans "Unpublished" %}</a>
-    <a {% if division = "publishing" %}class="active" {% endif %}href="{% url 'list_publishing' %}">{% trans "Publishing" %}</a>
-    <a {% if division = "published" %}class="active" {% endif %}href="{% url 'list_published' %}">{% trans "Published" %}</a>
-    <a {% if division = "unmanaged" %}class="active" {% endif %}href="{% url 'list_unmanaged' %}">{% trans "Archive" %}</a>
+    <a {% if division == "new" %}class="active" {% endif %}href="{% url 'list_new' %}">{% trans "New" %}</a>
+    <a {% if division == "unpublished" %}class="active" {% endif %}href="{% url 'list_unpublished' %}">{% trans "Unpublished" %}</a>
+    <a {% if division == "publishing" %}class="active" {% endif %}href="{% url 'list_publishing' %}">{% trans "Publishing" %}</a>
+    <a {% if division == "published" %}class="active" {% endif %}href="{% url 'list_published' %}">{% trans "Published" %}</a>
+    <a {% if division == "unmanaged" %}class="active" {% endif %}href="{% url 'list_unmanaged' %}">{% trans "Archive" %}</a>
     {% if user.is_staff %}
         <a href='{% url "admin:archive_project_changelist" %}'>{% trans "Projects" %}</a>
     {% endif %}
     {% if user.is_staff %}
         <a href='{% url "admin:archive_project_changelist" %}'>{% trans "Projects" %}</a>
     {% endif %}
index fabf446..28019cd 100644 (file)
@@ -16,7 +16,7 @@
 {% block file-list %}
     {% for file in objects %}
         <li>
 {% block file-list %}
     {% for file in objects %}
         <li>
-            <a href='{% url "file_new" file|urlencode %}'>{{ file }}</a>
+            <a href='{% url "file_new" file %}'>{{ file }}</a>
         </li>
     {% endfor %}
 {% endblock %}
         </li>
     {% endfor %}
 {% endblock %}
index 6bcf9e0..055f05b 100755 (executable)
@@ -15,7 +15,7 @@
             {% for file in objects %}
             <li>
                 <a href='{% url "file" file.id %}'>{{ file }}</a>
             {% for file in objects %}
             <li>
                 <a href='{% url "file" file.id %}'>{{ file }}</a>
-                ({% if file.mp3_status = k.0 %}MP3{% if file.ogg_status = k.0 %}, {% endif %}{% endif %}{% if file.ogg_status = k.0 %}Ogg{% endif %})
+                ({% if file.mp3_status == k.0 %}MP3{% if file.ogg_status == k.0 %}, {% endif %}{% endif %}{% if file.ogg_status == k.0 %}Ogg{% endif %})
             </li>
             {% endfor %}
         </ul>
             </li>
             {% endfor %}
         </ul>
index fd48c33..df3ccfb 100755 (executable)
@@ -13,7 +13,7 @@
 {% block file-list %}
     {% for file in objects %}
         <li>
 {% block file-list %}
     {% for file in objects %}
         <li>
-            <a href='{% url "file_unmanaged" file|urlencode %}'>{{ file }}</a>
+            <a href='{% url "file_unmanaged" file %}'>{{ file }}</a>
         </li>
     {% endfor %}
 {% endblock %}
         </li>
     {% endfor %}
 {% endblock %}
index 5e0053f..4b69db8 100755 (executable)
@@ -1,9 +1,9 @@
-{% load i18n %}
+{% load i18n static %}
 <!DOCTYPE html>
 <html>
 <head>
     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
 <!DOCTYPE html>
 <html>
 <head>
     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}style.css?20110808" />
+    <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}" />
     <title>{% trans "Audiobook repository" %}</title>
 </head>
 <body>
     <title>{% trans "Audiobook repository" %}</title>
 </head>
 <body>
index efaeeea..0deb995 100644 (file)
@@ -1,25 +1,26 @@
-from django.conf.urls import patterns, include, url
+from django.conf.urls import url
 from django.views.generic import RedirectView
 from django.views.generic import RedirectView
+from . import views
 
 
-urlpatterns = patterns('',
+urlpatterns = [
     url(r'^$', RedirectView.as_view(url='new/')),
 
     url(r'^$', RedirectView.as_view(url='new/')),
 
-    url(r'^new/$', 'archive.views.list_new', name="list_new"),
-    url(r'^new/(.+)/$', 'archive.views.file_new', name="file_new"),
-    url(r'^move_to_archive/(.+)/$', 'archive.views.move_to_archive', name="move_to_archive"),
+    url(r'^new/$', views.list_new, name="list_new"),
+    url(r'^new/(.+)/$', views.file_new, name="file_new"),
+    url(r'^move_to_archive/(.+)/$', views.move_to_archive, name="move_to_archive"),
 
 
-    url(r'^unpublished/$', 'archive.views.list_unpublished', name="list_unpublished"),
-    url(r'^publishing/$', 'archive.views.list_publishing', name="list_publishing"),
-    url(r'^published/$', 'archive.views.list_published', name="list_published"),
-    url(r'^file/(\d+)/$', 'archive.views.file_managed', name="file"),
-    url(r'^publish/(\d+)/$', 'archive.views.publish', name="publish"),
-    url(r'^convert/(\d+)/$', 'archive.views.publish', {'publish': False}, name="convert"),
-    url(r'^download/(\d+)/$', 'archive.views.download', name="download"),
-    url(r'^download/(\d+)\.(mp3|ogg)$', 'archive.views.download', name="download"),
-    url(r'^cancel/(\d+)/$', 'archive.views.cancel_publishing', name="cancel_publishing"),
-    url(r'^remove_to_archive/(\d+)/$', 'archive.views.remove_to_archive', name="remove_to_archive"),
+    url(r'^unpublished/$', views.list_unpublished, name="list_unpublished"),
+    url(r'^publishing/$', views.list_publishing, name="list_publishing"),
+    url(r'^published/$', views.list_published, name="list_published"),
+    url(r'^file/(\d+)/$', views.file_managed, name="file"),
+    url(r'^publish/(\d+)/$', views.publish, name="publish"),
+    url(r'^convert/(\d+)/$', views.publish, {'publish': False}, name="convert"),
+    url(r'^download/(\d+)/$', views.download, name="download"),
+    url(r'^download/(\d+)\.(mp3|ogg)$', views.download, name="download"),
+    url(r'^cancel/(\d+)/$', views.cancel_publishing, name="cancel_publishing"),
+    url(r'^remove_to_archive/(\d+)/$', views.remove_to_archive, name="remove_to_archive"),
 
 
-    url(r'^unmanaged/$', 'archive.views.list_unmanaged', name="list_unmanaged"),
-    url(r'^unmanaged/(.+)/$', 'archive.views.file_unmanaged', name="file_unmanaged"),
-    url(r'^move_to_new/(.+)/$', 'archive.views.move_to_new', name="move_to_new"),
-)
+    url(r'^unmanaged/$', views.list_unmanaged, name="list_unmanaged"),
+    url(r'^unmanaged/(.+)/$', views.file_unmanaged, name="file_unmanaged"),
+    url(r'^move_to_new/(.+)/$', views.move_to_new, name="move_to_new"),
+]
index 3e89a8b..f169847 100644 (file)
@@ -25,7 +25,7 @@ class OverwriteStorage(FileSystemStorage):
             self.delete(name)
         return super(OverwriteStorage, self)._save(name, content)
 
             self.delete(name)
         return super(OverwriteStorage, self)._save(name, content)
 
-    def get_available_name(self, name):
+    def get_available_name(self, name, max_length):
         return name
 
 
         return name
 
 
@@ -39,6 +39,6 @@ def sha1_file(f):
 def all_files(root_path):
     root_len = len(root_path)
     for path, dirs, files in os.walk(root_path):
 def all_files(root_path):
     root_len = len(root_path)
     for path, dirs, files in os.walk(root_path):
-       for fname in files:
-           yield os.path.join(path, fname)[root_len:].lstrip('/')
+        for fname in files:
+            yield os.path.join(path, fname)[root_len:].lstrip('/')
 
 
index b5850a0..31ea9c3 100644 (file)
@@ -35,8 +35,8 @@ def list_new(request):
 def file_new(request, filename):
     division = 'new'
 
 def file_new(request, filename):
     division = 'new'
 
-    filepath = filename.encode('utf-8')
-    root_filepath = os.path.join(settings.NEW_PATH, filename.encode('utf-8'))
+    filepath = filename
+    root_filepath = os.path.join(settings.NEW_PATH, filename)
     if request.POST:
         form = AudiobookForm(request.POST)
         if form.is_valid():
     if request.POST:
         form = AudiobookForm(request.POST)
         if form.is_valid():
index e69de29..e331a74 100644 (file)
@@ -0,0 +1,5 @@
+from __future__ import absolute_import, unicode_literals
+
+from .celery import app as celery_app
+
+__all__ = ('celery_app',)
diff --git a/src/audiobooks/celery.py b/src/audiobooks/celery.py
new file mode 100644 (file)
index 0000000..8da78a4
--- /dev/null
@@ -0,0 +1,9 @@
+from __future__ import absolute_import, unicode_literals
+import os
+from celery import Celery
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'audiobooks.settings')
+app = Celery('audiobooks')
+app.config_from_object('django.conf:settings', namespace='CELERY')
+
+app.autodiscover_tasks()
index 6ec4fe7..2d8a682 100644 (file)
@@ -7,7 +7,6 @@ PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
 
 
 DEBUG = False
 
 
 DEBUG = False
-TEMPLATE_DEBUG = DEBUG
 
 ADMINS = (
     # ('Your Name', 'your_email@example.com'),
 
 ADMINS = (
     # ('Your Name', 'your_email@example.com'),
@@ -91,12 +90,20 @@ STATICFILES_FINDERS = (
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '8ehk^-+pr(o)k6lh_gl9+ks6gkd9u#fka7fv%ikpk(c%llqa6%'
 
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '8ehk^-+pr(o)k6lh_gl9+ks6gkd9u#fka7fv%ikpk(c%llqa6%'
 
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.Loader',
-    'django.template.loaders.app_directories.Loader',
-#     'django.template.loaders.eggs.Loader',
-)
+TEMPLATES = [
+    {
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
+        'APP_DIRS': True,
+        'OPTIONS': {
+            'context_processors': [
+                'django.template.context_processors.debug',
+                'django.template.context_processors.request',
+                'django.contrib.auth.context_processors.auth',
+                'django.contrib.messages.context_processors.messages',
+            ],
+        },
+    },
+]
 
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
 
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
@@ -114,12 +121,6 @@ AUTHENTICATION_BACKENDS = (
 
 ROOT_URLCONF = 'audiobooks.urls'
 
 
 ROOT_URLCONF = 'audiobooks.urls'
 
-TEMPLATE_DIRS = (
-    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
-    # Always use forward slashes, even on Windows.
-    # Don't forget to use absolute paths, not relative paths.
-)
-
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
@@ -127,15 +128,10 @@ INSTALLED_APPS = (
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.staticfiles',
-    # Uncomment the next line to enable the admin:
     'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
 
     'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
 
-    'djcelery',
-    'djkombu',
-
-    'south',
     'archive',
 )
 
     'archive',
 )
 
@@ -168,29 +164,17 @@ LOGGING = {
     }
 }
 
     }
 }
 
-#http://logowanie.nowoczesnapolska.org.pl/cas/'
-CAS_SERVER_URL = "http://logowanie.nowoczesnapolska.org.pl/cas/"
+CAS_SERVER_URL = "https://logowanie.nowoczesnapolska.org.pl/cas/"
 CAS_VERSION = "1"
 
 CAS_VERSION = "1"
 
-
 EMAIL_SUBJECT_PREFIX = '[Audio] '
 SERVER_EMAIL = 'no-reply@audio.wolnelektury.pl'
 EMAIL_HOST = 'localhost'
 EMAIL_PORT = 25
 
 EMAIL_SUBJECT_PREFIX = '[Audio] '
 SERVER_EMAIL = 'no-reply@audio.wolnelektury.pl'
 EMAIL_HOST = 'localhost'
 EMAIL_PORT = 25
 
-import djcelery
-djcelery.setup_loader()
-
-CELERY_SEND_TASK_ERROR_EMAILS = True
-BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
-BROKER_HOST = "localhost"
-BROKER_PORT = 5672
-BROKER_USER = "guest"
-BROKER_PASSWORD = "guest"
-BROKER_VHOST = "/"
-
+CELERY_BROKER_URL = 'redis://localhost:6379/0'
 
 try:
 
 try:
-    from localsettings import *
+    from .localsettings import *
 except:
     pass
 except:
     pass
index f3113c8..eb4f030 100644 (file)
@@ -1,21 +1,17 @@
 from django.conf import settings
 from django.conf import settings
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.views.generic import RedirectView
 from django.views.generic import RedirectView
+import django_cas.views
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 admin.autodiscover()
 
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
 admin.autodiscover()
 
-urlpatterns = patterns('',
-    url(r'^$', RedirectView.as_view(url='archive/')),
+urlpatterns = [
+    url(r'^$', RedirectView.as_view(url='archive/', permanent=False)),
     url(r'^archive/', include('archive.urls')),
 
     url(r'^admin/', include(admin.site.urls)),
     url(r'^archive/', include('archive.urls')),
 
     url(r'^admin/', include(admin.site.urls)),
-    url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
-    url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
-)
-
-if settings.DEBUG:
-    urlpatterns += patterns('',
-        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
-)
+    url(r'^accounts/login/$', django_cas.views.login, name='login'),
+    url(r'^accounts/logout/$', django_cas.views.logout, name='logout'),
+]
index 5e0ddaa..215d617 100644 (file)
@@ -1,5 +1,5 @@
 """
 """
-WSGI config for edumed project.
+WSGI config for audiobooks project.
 
 This module contains the WSGI application used by Django's development server
 and any production WSGI deployments. It should expose a module-level variable
 
 This module contains the WSGI application used by Django's development server
 and any production WSGI deployments. It should expose a module-level variable
index 3281d70..b59071a 100755 (executable)
@@ -1,14 +1,10 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
-from django.core.management import execute_manager
-import imp
-try:
-    imp.find_module('settings', ['audiobooks'])
-except ImportError:
-    import sys
-    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
-    sys.exit(1)
-
-import audiobooks.settings
+import os
+import sys
 
 if __name__ == "__main__":
 
 if __name__ == "__main__":
-    execute_manager(audiobooks.settings)
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "audiobooks.settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)