Skip to content
Snippets Groups Projects
Commit c08cb55f authored by Hamza Touizrat's avatar Hamza Touizrat
Browse files

Merge branch 'add_docker' into 'master'

add docker compose for backend

See merge request !60
parents ac5f18d5 cf0127ba
No related branches found
No related tags found
1 merge request!60add docker compose for backend
...@@ -32,3 +32,5 @@ static/ ...@@ -32,3 +32,5 @@ static/
# Supervisor # Supervisor
supervisord.pid supervisord.pid
sendgrid.env sendgrid.env
api_mail
.gitignore
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
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
...@@ -5,7 +5,7 @@ from .common import * ...@@ -5,7 +5,7 @@ from .common import *
from .common import BASE_DIR from .common import BASE_DIR
DEBUG = True 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) # Static files (CSS, JavaScript, Images) and media files (user-uploaded)
......
...@@ -15,8 +15,6 @@ DEBUG = os.environ.get('DEBUG', False) or False ...@@ -15,8 +15,6 @@ DEBUG = os.environ.get('DEBUG', False) or False
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
'localhost', 'localhost',
'oser-backend.herokuapp.com',
'oser-backend-dev.herokuapp.com',
'oser-cs.fr', 'oser-cs.fr',
] ]
......
# 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),
),
]
# Core packages autopep8==1.7.0
django==2.2 boto3==1.24.45
djangorestframework==3.8 botocore==1.27.45
certifi==2022.6.15
# Admin enhancements cffi==1.15.1
django-admin-sortable2 # Sorting items in the admin panel charset-normalizer==2.1.0
django-countries click==8.1.3
django-guardian # Permissions coreapi==2.3.3
coreapi-cli==1.0.9
# Email via SendGrid coreschema==0.0.4
django-sendgrid-v5 cryptography==37.0.4
django-filter dj-database-url==0.5.0
django-rest-auth Django==2.2
django-admin-sortable2==1.0
# Telegram messages via python-telegram-bot django-cors-headers==2.2.0
tornado==6.1 django-countries==7.3.2
python-telegram-bot==12.2.0 django-filter==2.1.0
django-guardian==2.4.0
# Storage of files in AWS S3 django-heroku==0.3.1
django-storages django-markdownx==3.0.1
boto3 django-rest-auth==0.9.5
django-sendgrid-v5==1.2.1
# PostgreSQL integration django-storages==1.12.3
dj-database-url 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 psycopg2==2.8.6
pycodestyle==2.9.1
# Django REST Framework extensions pycparser==2.21
coreapi-cli # Required for automatic API docs pymdown-extensions==4.9
django-cors-headers # CORS (security headers sent by browsers) python-dateutil==2.8.2
django-filter # Filtering helpers for API endpoints python-dotenv==0.11.0
django-rest-auth # Password reset views python-http-client==3.3.7
dry_rest_permissions python-telegram-bot==12.2.0
pytz==2022.1
# Markdown rendering requests==2.28.1
django-markdownx s3transfer==0.6.0
pymdown-extensions sendgrid==6.9.7
Pillow six==1.16.0
sqlparse==0.4.2
# Testing starkbank-ecdsa==2.0.3
factory-boy toml==0.10.2
tornado==6.1
# Miscellanneous typing-extensions==4.3.0
python-dotenv==0.11 uritemplate==4.1.1
urllib3==1.26.11
# Deployment whitenoise==6.2.0
django-heroku # Heroku integration
whitenoise # Static files serving
gunicorn # Web server
...@@ -3,9 +3,10 @@ from ..models import Participation ...@@ -3,9 +3,10 @@ from ..models import Participation
def postgres_migration_prep(apps, schema_editor): def postgres_migration_prep(apps, schema_editor):
participations = Participation.objects.filter(accepted=True) # participations = Participation.objects.filter(accepted=True)
for participation in participations: # for participation in participations:
participation.accepted = 1 # participation.accepted = 1
pass
class Migration(migrations.Migration): class Migration(migrations.Migration):
......
# 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.'),
),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment