mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-11-28 11:13:36 +01:00
documentation, admin section, plus fix of a typo on models (#293)
* documentation, admin section, plus fix of a typo on models
This commit is contained in:
parent
32e07035f3
commit
4480fa7de1
@ -15,6 +15,7 @@
|
|||||||
- [12. Video transcoding](#12-video-transcoding)
|
- [12. Video transcoding](#12-video-transcoding)
|
||||||
- [13. How To Add A Static Page To The Sidebar](#13-how-to-add-a-static-page-to-the-sidebar)
|
- [13. How To Add A Static Page To The Sidebar](#13-how-to-add-a-static-page-to-the-sidebar)
|
||||||
- [14. Add Google Analytics](#14-add-google-analytics)
|
- [14. Add Google Analytics](#14-add-google-analytics)
|
||||||
|
- [15. Debugging email issues](#15-debugging-email-issues)
|
||||||
|
|
||||||
|
|
||||||
## 1. Welcome
|
## 1. Welcome
|
||||||
@ -648,3 +649,38 @@ Instructions contributed by @alberto98fx
|
|||||||
- ./templates/tracking.html://home/mediacms.io/mediacms/templates/tracking.html
|
- ./templates/tracking.html://home/mediacms.io/mediacms/templates/tracking.html
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 15. Debugging email issues
|
||||||
|
On the [Configuration](https://github.com/mediacms-io/mediacms/blob/main/docs/admins_docs.md#5-configuration) section of this guide we've see how to edit the email settings.
|
||||||
|
In case we are yet unable to receive email from MediaCMS, the following may help us debug the issue - in most cases it is an issue of setting the correct username, password or TLS option
|
||||||
|
|
||||||
|
Enter the Django shell, example if you're using the Single Server installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source /home/mediacms.io/bin/activate
|
||||||
|
python manage.py shell
|
||||||
|
```
|
||||||
|
|
||||||
|
and inside the shell
|
||||||
|
|
||||||
|
```bash
|
||||||
|
from django.core.mail import EmailMessage
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
settings.EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||||
|
|
||||||
|
email = EmailMessage(
|
||||||
|
'title',
|
||||||
|
'msg',
|
||||||
|
settings.DEFAULT_FROM_EMAIL,
|
||||||
|
['recipient@email.com'],
|
||||||
|
)
|
||||||
|
email.send(fail_silently=False)
|
||||||
|
```
|
||||||
|
|
||||||
|
You have the chance to either receive the email (in this case it will be sent to recipient@email.com) otherwise you will see the error.
|
||||||
|
For example, while specifying wrong password for my Gmail account I get
|
||||||
|
|
||||||
|
```
|
||||||
|
SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials d4sm12687785wrc.34 - gsmtp')
|
||||||
|
```
|
18
files/migrations/0003_auto_20210927_1245.py
Normal file
18
files/migrations/0003_auto_20210927_1245.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.1.12 on 2021-09-27 11:45
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('files', '0002_auto_20201201_0712'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='media',
|
||||||
|
name='reported_times',
|
||||||
|
field=models.IntegerField(default=0, help_text='how many time a media is reported'),
|
||||||
|
),
|
||||||
|
]
|
@ -209,7 +209,7 @@ class Media(models.Model):
|
|||||||
help_text="Rating category, if media Rating is allowed",
|
help_text="Rating category, if media Rating is allowed",
|
||||||
)
|
)
|
||||||
|
|
||||||
reported_times = models.IntegerField(default=0, help_text="how many time a Medis is reported")
|
reported_times = models.IntegerField(default=0, help_text="how many time a media is reported")
|
||||||
|
|
||||||
search = SearchVectorField(
|
search = SearchVectorField(
|
||||||
null=True,
|
null=True,
|
||||||
|
@ -20,7 +20,11 @@ class TestX(TestCase):
|
|||||||
client.login(username=self.user, password=self.password)
|
client.login(username=self.user, password=self.password)
|
||||||
|
|
||||||
# use both ways, form + API to upload a new media file
|
# use both ways, form + API to upload a new media file
|
||||||
# ffmpeg will transcode files synchronously
|
# while video transcoding through ffmpeg takes place asynchronously
|
||||||
|
# (through celery workers), inside tests ffmpeg runs synchronously
|
||||||
|
# because celery is started with setting task_always_eager
|
||||||
|
# practically this means that this testing will take some time, but
|
||||||
|
# ensures that video transcoding completes well
|
||||||
with open('fixtures/small_video.mp4', 'rb') as fp:
|
with open('fixtures/small_video.mp4', 'rb') as fp:
|
||||||
client.post('/api/v1/media', {'title': 'small video file test', 'media_file': fp})
|
client.post('/api/v1/media', {'title': 'small video file test', 'media_file': fp})
|
||||||
|
|
||||||
@ -31,9 +35,14 @@ class TestX(TestCase):
|
|||||||
client.post('/fu/upload/', {'qqfile': fp, 'qqfilename': 'medium_video.mp4', 'qquuid': str(uuid.uuid4())})
|
client.post('/fu/upload/', {'qqfile': fp, 'qqfilename': 'medium_video.mp4', 'qquuid': str(uuid.uuid4())})
|
||||||
|
|
||||||
self.assertEqual(Media.objects.all().count(), 3, "Problem with file upload")
|
self.assertEqual(Media.objects.all().count(), 3, "Problem with file upload")
|
||||||
|
|
||||||
|
# by default the portal_workflow is public, so anything uploaded gets public
|
||||||
self.assertEqual(Media.objects.filter(state='public').count(), 3, "Expected all media to be public, as per the default portal workflow")
|
self.assertEqual(Media.objects.filter(state='public').count(), 3, "Expected all media to be public, as per the default portal workflow")
|
||||||
self.assertEqual(Media.objects.filter(media_type='video', encoding_status='success').count(), 2, "Encoding did not finish well")
|
self.assertEqual(Media.objects.filter(media_type='video', encoding_status='success').count(), 2, "Encoding did not finish well")
|
||||||
self.assertEqual(Media.objects.filter(media_type='video').count(), 2, "Media identification failed")
|
self.assertEqual(Media.objects.filter(media_type='video').count(), 2, "Media identification failed")
|
||||||
self.assertEqual(Media.objects.filter(media_type='image').count(), 1, "Media identification failed")
|
self.assertEqual(Media.objects.filter(media_type='image').count(), 1, "Media identification failed")
|
||||||
self.assertEqual(Media.objects.filter(user=self.user).count(), 3, "User assignment failed")
|
self.assertEqual(Media.objects.filter(user=self.user).count(), 3, "User assignment failed")
|
||||||
|
|
||||||
|
# using the provided EncodeProfiles, these two files should produce 9 Encoding objects.
|
||||||
|
# if new EncodeProfiles are added and enabled, this will break!
|
||||||
self.assertEqual(Encoding.objects.filter(status='success').count(), 9, "Not all video transcodings finished well")
|
self.assertEqual(Encoding.objects.filter(status='success').count(), 9, "Not all video transcodings finished well")
|
||||||
|
Loading…
Reference in New Issue
Block a user