Tentative de rendre fonctionnel le code en version prod

This commit is contained in:
Jean-Marie Favreau 2023-11-15 16:00:08 +01:00
parent b509e3d7da
commit 1e485998c1
24 changed files with 93 additions and 369 deletions

View File

@ -1,5 +1,6 @@
#!/bin/bash
# Run migrations, collect static files and start server
if [ "$APP_ENV" != "prod" ]; then
python manage.py makemigrations --noinput

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
wait_for_it=$(dirname "$0")/wait-for-it.sh

View File

@ -20,7 +20,7 @@ services:
- "${APP_PORT:-8000}"
depends_on:
- db
command: [ "/bin/sh", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/backend/start.sh" ]
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/backend/start.sh" ]
db:
image: postgres:15.2-alpine
@ -60,12 +60,12 @@ services:
- db
- redis
- backend
command: [ "/bin/sh", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-worker.sh" ]
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-worker.sh" ]
celery-beat:
<<: *celery-worker
container_name: "${APP_NAME}-celery-beat"
command: [ "/bin/sh", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-beat.sh" ]
command: [ "/bin/bash", "/app/deployment/scripts/wait-db.sh", "/app/deployment/scripts/celery/start-beat.sh" ]
nginx:
image: nginx:latest

View File

@ -1,7 +1,10 @@
# Generated by Django 4.2.1 on 2023-10-14 16:33
# Generated by Django 4.2.7 on 2023-11-15 14:57
import django.contrib.postgres.fields
import ckeditor.fields
import colorfield.fields
from django.db import migrations, models
import django.db.models.deletion
import django_better_admin_arrayfield.models.fields
class Migration(migrations.Migration):
@ -12,6 +15,41 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Category name', max_length=512, verbose_name='Name')),
('alt_name', models.CharField(help_text='Alternative name used with a time period', max_length=512, verbose_name='Alternative Name')),
('codename', models.CharField(help_text='Short name of the category', max_length=3, verbose_name='Short name')),
('color', colorfield.fields.ColorField(blank=True, default=None, help_text='Color used as background for the category', image_field=None, max_length=25, null=True, samples=None, verbose_name='Color')),
],
options={
'verbose_name': 'Category',
'verbose_name_plural': 'Categories',
},
),
migrations.CreateModel(
name='EventSubmissionForm',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField(help_text='URL where this event can be found.', max_length=512, verbose_name='URL')),
],
options={
'verbose_name': 'Event submission form',
'verbose_name_plural': 'Event submissions forms',
'db_table': 'eventsubmissionform',
},
),
migrations.CreateModel(
name='StaticContent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Category name', max_length=512, unique=True, verbose_name='Name')),
('text', ckeditor.fields.RichTextField(help_text='Text as shown to the visitors', verbose_name='Content')),
('url_path', models.CharField(help_text='URL path where the content is included.', verbose_name='URL path')),
],
),
migrations.CreateModel(
name='Event',
fields=[
@ -26,9 +64,12 @@ class Migration(migrations.Migration):
('end_time', models.TimeField(blank=True, help_text='Final time', null=True, verbose_name='Final time')),
('location', models.CharField(help_text='Address of the event', max_length=512, verbose_name='Location')),
('description', models.TextField(blank=True, help_text='General description of the event', null=True, verbose_name='Description')),
('image', models.URLField(blank=True, help_text='URL of the illustration image', null=True, verbose_name='Illustration')),
('image_alt', models.CharField(blank=True, help_text='Alternative text used by screen readers for the image', max_length=512, null=True, verbose_name='Illustration description')),
('reference_urls', django.contrib.postgres.fields.ArrayField(base_field=models.URLField(), blank=True, help_text='List of all the urls where this event can be found.', null=True, size=None, verbose_name='URLs')),
('local_image', models.ImageField(blank=True, help_text='Illustration image stored in the agenda server', max_length=1024, null=True, upload_to='', verbose_name='Illustration (local image)')),
('image', models.URLField(blank=True, help_text='URL of the illustration image', max_length=1024, null=True, verbose_name='Illustration')),
('image_alt', models.CharField(blank=True, help_text='Alternative text used by screen readers for the image', max_length=1024, null=True, verbose_name='Illustration description')),
('reference_urls', django_better_admin_arrayfield.models.fields.ArrayField(base_field=models.URLField(max_length=512), blank=True, help_text='List of all the urls where this event can be found.', null=True, size=None, verbose_name='URLs')),
('tags', django_better_admin_arrayfield.models.fields.ArrayField(base_field=models.CharField(max_length=64), blank=True, help_text='A list of tags that describe the event.', null=True, size=None, verbose_name='Tags')),
('category', models.ForeignKey(default=None, help_text='Category of the event', null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.category', verbose_name='Category')),
],
options={
'verbose_name': 'Event',

View File

@ -0,0 +1,19 @@
# Generated by Django 4.2.7 on 2023-11-15 14:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='event',
name='category',
field=models.ForeignKey(default=1, help_text='Category of the event', on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.category', verbose_name='Category'),
),
]

View File

@ -1,31 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-15 08:51
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='EventSubmissionForm',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField(help_text='URL where this event can be found.', max_length=512, verbose_name='URL')),
],
options={
'verbose_name': 'Event submission form',
'verbose_name_plural': 'Event submissions forms',
'db_table': 'eventsubmissionform',
},
),
migrations.AlterField(
model_name='event',
name='reference_urls',
field=django.contrib.postgres.fields.ArrayField(base_field=models.URLField(max_length=512), blank=True, help_text='List of all the urls where this event can be found.', null=True, size=None, verbose_name='URLs'),
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-21 14:59
import colorfield.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0002_eventsubmissionform_alter_event_reference_urls'),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Category name', max_length=512, verbose_name='Name')),
('codename', models.CharField(help_text='Short name of the category', max_length=3, verbose_name='Short name')),
('color', colorfield.fields.ColorField(default='#CCCCCCC', help_text='Color used as background for the category', image_field=None, max_length=25, samples=None, verbose_name='Color')),
],
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-21 19:18
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0003_category'),
]
operations = [
migrations.AlterField(
model_name='category',
name='color',
field=colorfield.fields.ColorField(default='#FFFFFF', help_text='Color used as background for the category', image_field=None, max_length=25, samples=None, verbose_name='Color'),
),
]

View File

@ -1,17 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-21 19:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0004_alter_category_color'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'verbose_name': 'Category', 'verbose_name_plural': 'Categories'},
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-22 16:54
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0005_alter_category_options'),
]
operations = [
migrations.AlterField(
model_name='category',
name='color',
field=colorfield.fields.ColorField(blank=True, default=None, help_text='Color used as background for the category', image_field=None, max_length=25, null=True, samples=None, verbose_name='Color'),
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-28 19:50
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0006_alter_category_color'),
]
operations = [
migrations.AddField(
model_name='event',
name='category',
field=models.ForeignKey(help_text='Category of the event', null=True, on_delete=django.db.models.deletion.SET_NULL, to='agenda_culturel.category', verbose_name='Category'),
),
migrations.AddField(
model_name='event',
name='tags',
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=64), blank=True, help_text='A list of tags that describe the event.', null=True, size=None, verbose_name='Tags'),
),
]

View File

@ -1,24 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-29 13:51
from django.db import migrations, models
import django_better_admin_arrayfield.models.fields
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0007_event_category_event_tags'),
]
operations = [
migrations.AlterField(
model_name='event',
name='reference_urls',
field=django_better_admin_arrayfield.models.fields.ArrayField(base_field=models.URLField(max_length=512), blank=True, help_text='List of all the urls where this event can be found.', null=True, size=None, verbose_name='URLs'),
),
migrations.AlterField(
model_name='event',
name='tags',
field=django_better_admin_arrayfield.models.fields.ArrayField(base_field=models.CharField(max_length=64), blank=True, help_text='A list of tags that describe the event.', null=True, size=None, verbose_name='Tags'),
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-29 21:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0008_alter_event_reference_urls_alter_event_tags'),
]
operations = [
migrations.AddField(
model_name='category',
name='plural',
field=models.CharField(default='1', help_text='Category name (plural)', max_length=512, verbose_name='Plural nName'),
preserve_default=False,
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 4.2.1 on 2023-10-29 21:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0009_category_plural'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='plural',
),
migrations.AddField(
model_name='category',
name='alt_name',
field=models.CharField(default='1', help_text='Alternative name used with a time period', max_length=512, verbose_name='Alternative Name'),
preserve_default=False,
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-08 11:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0010_remove_category_plural_category_alt_name'),
]
operations = [
migrations.AlterField(
model_name='event',
name='category',
field=models.ForeignKey(default=47, help_text='Category of the event', on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.category', verbose_name='Category'),
),
]

View File

@ -1,22 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-09 21:35
import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0011_alter_event_category'),
]
operations = [
migrations.CreateModel(
name='StaticContent',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Category name', max_length=512, unique=True, verbose_name='Name')),
('text', ckeditor.fields.RichTextField(help_text='Text as shown to the visitors', verbose_name='Content')),
],
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-09 22:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0012_staticcontent'),
]
operations = [
migrations.AddField(
model_name='staticcontent',
name='url_path',
field=models.CharField(default='', help_text='URL path where the content is included.', verbose_name='URL path'),
preserve_default=False,
),
]

View File

@ -1,23 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-11 17:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0013_staticcontent_url_path'),
]
operations = [
migrations.AlterField(
model_name='event',
name='image',
field=models.URLField(blank=True, help_text='URL of the illustration image', max_length=1024, null=True, verbose_name='Illustration'),
),
migrations.AlterField(
model_name='event',
name='image_alt',
field=models.CharField(blank=True, help_text='Alternative text used by screen readers for the image', max_length=1024, null=True, verbose_name='Illustration description'),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-11 20:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0014_alter_event_image_alter_event_image_alt'),
]
operations = [
migrations.AddField(
model_name='event',
name='local_image',
field=models.URLField(blank=True, help_text='Illustration image stored in the agenda server', max_length=1024, null=True, verbose_name='Illustration (local image)'),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 4.2.1 on 2023-11-11 20:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0015_event_local_image'),
]
operations = [
migrations.AlterField(
model_name='event',
name='local_image',
field=models.ImageField(blank=True, help_text='Illustration image stored in the agenda server', max_length=1024, null=True, upload_to='', verbose_name='Illustration (local image)'),
),
]

View File

@ -130,7 +130,10 @@ class Event(models.Model):
verbose_name_plural = _('Events')
def get_all_tags():
tags = list(Event.objects.values_list('tags', flat = True))
try:
tags = list(Event.objects.values_list('tags', flat = True))
except:
tags = []
uniq_tags = set()
for t in tags:
if t is not None:

View File

@ -16,6 +16,7 @@ def main():
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
print("commande: " + str(sys.argv))
execute_from_command_line(sys.argv)

View File

@ -1,26 +1,26 @@
amqp==5.1.1
asgiref==3.6.0
billiard==3.6.4.0
celery==5.2.7
click==8.1.3
amqp==5.2.0
asgiref==3.7.2
billiard==4.2.0
celery==5.3.5
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
Django==4.2.1
django-cors-headers==3.14.0
gunicorn==20.1.0
kombu==5.2.4
prompt-toolkit==3.0.38
psycopg==3.1.9
pytz==2023.3
Django==4.2.7
django-cors-headers==4.3.1
gunicorn==21.2.0
kombu==5.3.3
prompt-toolkit==3.0.41
psycopg==3.1.12
pytz==2023.3.post1
six==1.16.0
sqlparse==0.4.4
typing_extensions==4.5.0
vine==5.0.0
wcwidth==0.2.6
redis==4.5.5
whitenoise==6.4.0
selenium==4.14.0
typing_extensions==4.8.0
vine==5.1.0
wcwidth==0.2.10
redis==5.0.1
whitenoise==6.6.0
selenium==4.15.2
BeautifulSoup4==4.12.2
watchdog==3.0.0
django-colorfield==0.10.1

View File

@ -1,23 +0,0 @@
# Generated by Django 4.2.1 on 2023-05-10 11:29
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TestModel',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField()),
('file', models.FileField(upload_to='test_app/files/')),
],
),
]