diff --git a/.gitignore b/.gitignore index c4f4ed67f77c82d7555059e4e059483a4b04820e..5dbbd65e2daafe0797dccceaef563d7d829e8088 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ static/ # Supervisor supervisord.pid sendgrid.env +api_mail +.gitignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..06f76d938aac3565e1ce70bdcf475ea71ab08274 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.8 +WORKDIR /var/www/oser-backend +ENV DEBIAN_FRONTEND=noninteractive +RUN apt update && apt install -y build-essential postgresql libpq-dev python3-dev git +COPY ./requirements.txt . +VOLUME [ "/var/www/oser-backend" ] +EXPOSE 8000 +RUN python3 -m pip install -r requirements.txt +CMD python3 manage.py makemigrations && python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..2485e2d949d7ee080445e615dc0d1c66ba92199c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.1' + +services: + + db: + container_name: postgres + image: postgres + restart: always + volumes: + - db_data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: q + POSTGRES_DB: oser_backend_db + + oser-backend: + container_name: oser-backend + build: + context: . + dockerfile: Dockerfile + restart: always + volumes: + - .:/var/www/oser-backend + ports: + - "8000:8000" + depends_on: + - db + oser-frontend: + container_name: oser-frontend + build: + context: ../oser-frontend + dockerfile: Dockerfile + restart: always + volumes: + - .:/var/www/oser-backend + ports: + - "4200:4200" +volumes: + db_data: {} \ No newline at end of file diff --git a/oser_backend/settings/dev.py b/oser_backend/settings/dev.py index 7fdc70c6c757615b22e20602071100a925baabb6..719f54ecabf007a8fd99cac9a6c61a76697064e5 100644 --- a/oser_backend/settings/dev.py +++ b/oser_backend/settings/dev.py @@ -5,7 +5,7 @@ from .common import * from .common import BASE_DIR DEBUG = True -ALLOWED_HOSTS = ['localhost','127.0.0.1'] +ALLOWED_HOSTS = ['localhost','127.0.0.1','oser-backend'] # Static files (CSS, JavaScript, Images) and media files (user-uploaded) diff --git a/oser_backend/settings/production.py b/oser_backend/settings/production.py index 1211646db84de6be968c5e27340ffc1206fc3c81..bd8566466f50e8bf405775f0a6f74c8ff4181e63 100644 --- a/oser_backend/settings/production.py +++ b/oser_backend/settings/production.py @@ -15,8 +15,6 @@ DEBUG = os.environ.get('DEBUG', False) or False ALLOWED_HOSTS = [ 'localhost', - 'oser-backend.herokuapp.com', - 'oser-backend-dev.herokuapp.com', 'oser-cs.fr', ] diff --git a/profiles/migrations/0017_auto_20221111_2210.py b/profiles/migrations/0017_auto_20221111_2210.py new file mode 100644 index 0000000000000000000000000000000000000000..2dd7f17cabc1ec415d72e4d7b62b57ee441fc7fd --- /dev/null +++ b/profiles/migrations/0017_auto_20221111_2210.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2022-11-11 21:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('profiles', '0016_auto_20211225_1242'), + ] + + operations = [ + migrations.AlterField( + model_name='tutor', + name='promotion', + field=models.IntegerField(choices=[(2025, '2025'), (2024, '2024'), (2023, '2023'), (2022, '2022'), (2021, '2021')], default=2025), + ), + ] diff --git a/requirements.txt b/requirements.txt index 452e64dd128f00575071340378f2be476caa1c45..2ad213eaf0f2ce82461392d98a0ac153cb887f75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,48 +1,58 @@ -# Core packages -django==2.2 -djangorestframework==3.8 - -# Admin enhancements -django-admin-sortable2 # Sorting items in the admin panel -django-countries -django-guardian # Permissions - -# Email via SendGrid -django-sendgrid-v5 -django-filter -django-rest-auth - -# Telegram messages via python-telegram-bot -tornado==6.1 -python-telegram-bot==12.2.0 - -# Storage of files in AWS S3 -django-storages -boto3 - -# PostgreSQL integration -dj-database-url +autopep8==1.7.0 +boto3==1.24.45 +botocore==1.27.45 +certifi==2022.6.15 +cffi==1.15.1 +charset-normalizer==2.1.0 +click==8.1.3 +coreapi==2.3.3 +coreapi-cli==1.0.9 +coreschema==0.0.4 +cryptography==37.0.4 +dj-database-url==0.5.0 +Django==2.2 +django-admin-sortable2==1.0 +django-cors-headers==2.2.0 +django-countries==7.3.2 +django-filter==2.1.0 +django-guardian==2.4.0 +django-heroku==0.3.1 +django-markdownx==3.0.1 +django-rest-auth==0.9.5 +django-sendgrid-v5==1.2.1 +django-storages==1.12.3 +Django-Verify-Email==2.0.3 +djangorestframework==3.8.0 +dry-rest-permissions==0.1.10 +factory-boy==3.2.1 +Faker==13.15.1 +future==0.18.2 +gunicorn==20.1.0 +idna==3.3 +itypes==1.2.0 +Jinja2==3.1.2 +jmespath==1.0.1 +Markdown==3.0.1 +MarkupSafe==2.1.1 +Pillow==9.2.0 psycopg2==2.8.6 - -# Django REST Framework extensions -coreapi-cli # Required for automatic API docs -django-cors-headers # CORS (security headers sent by browsers) -django-filter # Filtering helpers for API endpoints -django-rest-auth # Password reset views -dry_rest_permissions - -# Markdown rendering -django-markdownx -pymdown-extensions -Pillow - -# Testing -factory-boy - -# Miscellanneous -python-dotenv==0.11 - -# Deployment -django-heroku # Heroku integration -whitenoise # Static files serving -gunicorn # Web server +pycodestyle==2.9.1 +pycparser==2.21 +pymdown-extensions==4.9 +python-dateutil==2.8.2 +python-dotenv==0.11.0 +python-http-client==3.3.7 +python-telegram-bot==12.2.0 +pytz==2022.1 +requests==2.28.1 +s3transfer==0.6.0 +sendgrid==6.9.7 +six==1.16.0 +sqlparse==0.4.2 +starkbank-ecdsa==2.0.3 +toml==0.10.2 +tornado==6.1 +typing-extensions==4.3.0 +uritemplate==4.1.1 +urllib3==1.26.11 +whitenoise==6.2.0 diff --git a/visits/migrations/0005_auto_20221111_2210.py b/visits/migrations/0005_auto_20221111_2210.py new file mode 100644 index 0000000000000000000000000000000000000000..539e4959cf7cd559213f3f5a3b292f97022be7e1 --- /dev/null +++ b/visits/migrations/0005_auto_20221111_2210.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2022-11-11 21:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('visits', '0004_auto_20211225_1242'), + ] + + operations = [ + migrations.AlterField( + model_name='participation', + name='accepted', + field=models.IntegerField(choices=[(0, 'refusé'), (1, 'accepté'), (2, 'en attente'), (3, 'inconnue')], default=3, help_text='Cocher pour confirmer au tutoré sa participation à la sortie.'), + ), + ]