db migrations

This commit is contained in:
Ruidy Nemausat 2020-01-02 22:20:56 +01:00
parent 828deb545d
commit 97a4f5e02f
32 changed files with 674 additions and 15 deletions

2
.gitignore vendored
View file

@ -3,7 +3,7 @@
env/
__pycache__/
rental/__pycache__/
rental/migrations/
# rental/migrations/
villafleurie/__pycache__/
villafleurie/staticfiles/
villafleurie/static_files/

View file

@ -1,16 +1,25 @@
version: "3"
volumes:
dbdata:
static_files:
media:
services:
db:
image: postgres
environment:
POSTGRES_USER: villafleurie
POSTGRES_DB: villafleurie
POSTGRES_PASS: villafleurie
volumes:
- dbdata:/var/lib/postgresql/data
ports:
- 5432:5432
web:
build: .
command: bash -c "python manage.py migrate && python manage.py loaddata villafleurie.json && gunicorn -w 4 villafleurie.wsgi -b 0.0.0.0:8000"
# command: bash -c "python manage.py migrate && python manage.py loaddata villafleurie.json && gunicorn -w 4 villafleurie.wsgi -b 0.0.0.0:8000"
command: bash -c "python manage.py migrate && gunicorn -w 4 villafleurie.wsgi -b 0.0.0.0:8000"
volumes:
- .:/villafleurie
- static_files:/static_files
@ -20,7 +29,6 @@ services:
depends_on:
- db
env_file: prod.env
nginx:
build:
context: .

View file

@ -0,0 +1,73 @@
# Generated by Django 2.2.6 on 2019-11-06 11:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Guest',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('email', models.EmailField(max_length=254, unique=True)),
('phone', models.CharField(blank=True, max_length=128)),
],
options={
'verbose_name': 'Voyageur',
},
),
migrations.CreateModel(
name='Place',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=10, unique=True)),
('pictures', models.ImageField(
blank=True, null=True, upload_to='uploads/')),
('decription', models.TextField(blank=True)),
('tagline', models.CharField(blank=True, max_length=100)),
('price', models.DecimalField(
decimal_places=2, max_digits=6, null=True)),
],
options={
'verbose_name': 'Appartement',
},
),
migrations.CreateModel(
name='Reservation',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('guest', models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to='rental.Guest')),
('place', models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to='rental.Place')),
],
options={
'verbose_name': 'Réservation',
},
),
migrations.CreateModel(
name='Testimonial',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100)),
('text', models.TextField()),
('reservation', models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to='rental.Reservation')),
],
options={
'verbose_name': 'Témoignage',
},
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-06 15:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='place',
old_name='decription',
new_name='description',
),
migrations.AddField(
model_name='place',
name='subname',
field=models.CharField(blank=True, max_length=100),
),
]

View file

@ -0,0 +1,28 @@
# Generated by Django 2.2.6 on 2019-11-07 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0002_auto_20191106_1542'),
]
operations = [
migrations.AddField(
model_name='place',
name='beds',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='place',
name='max_occupation',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='place',
name='surface',
field=models.IntegerField(blank=True, null=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-07 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0003_auto_20191107_1031'),
]
operations = [
migrations.AddField(
model_name='place',
name='info',
field=models.TextField(blank=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-07 13:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0004_place_info'),
]
operations = [
migrations.AddField(
model_name='reservation',
name='message',
field=models.TextField(blank=True),
),
]

View file

@ -0,0 +1,29 @@
# Generated by Django 2.2.6 on 2019-11-07 21:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0005_reservation_message'),
]
operations = [
migrations.RenameField(
model_name='testimonial',
old_name='title',
new_name='author',
),
migrations.AddField(
model_name='testimonial',
name='guest',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental.Guest'),
),
migrations.AddField(
model_name='testimonial',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='uploads/'),
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-11-07 21:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0006_auto_20191107_2114'),
]
operations = [
migrations.AlterField(
model_name='testimonial',
name='reservation',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental.Reservation'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-07 22:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0007_auto_20191107_2116'),
]
operations = [
migrations.AddField(
model_name='testimonial',
name='link',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='testimonial',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='img/'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-07 22:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0008_auto_20191107_2214'),
]
operations = [
migrations.AlterField(
model_name='place',
name='pictures',
field=models.ImageField(blank=True, null=True, upload_to='img/'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-07 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0009_auto_20191107_2220'),
]
operations = [
migrations.AlterField(
model_name='place',
name='pictures',
field=models.ImageField(blank=True, null=True, upload_to='uploads/'),
),
migrations.AlterField(
model_name='testimonial',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='uploads/'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-07 22:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0010_auto_20191107_2221'),
]
operations = [
migrations.AlterField(
model_name='place',
name='pictures',
field=models.ImageField(blank=True, null=True, upload_to='img/'),
),
migrations.AlterField(
model_name='testimonial',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='img/'),
),
]

View file

@ -0,0 +1,31 @@
# Generated by Django 2.2.6 on 2019-11-10 18:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0011_auto_20191107_2223'),
]
operations = [
migrations.CreateModel(
name='Image',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('img', models.ImageField(blank=True, null=True, upload_to='img/')),
('alt', models.CharField(max_length=100)),
],
),
migrations.RemoveField(
model_name='place',
name='pictures',
),
migrations.AddField(
model_name='place',
name='images',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental.Image'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-10 18:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0012_auto_20191110_1814'),
]
operations = [
migrations.RemoveField(
model_name='place',
name='images',
),
migrations.AddField(
model_name='image',
name='place',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental.Place'),
),
]

View file

@ -0,0 +1,22 @@
# Generated by Django 2.2.6 on 2019-11-10 18:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0013_auto_20191110_1817'),
]
operations = [
migrations.RemoveField(
model_name='image',
name='place',
),
migrations.AddField(
model_name='image',
name='place',
field=models.ManyToManyField(blank=True, null=True, to='rental.Place'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-10 18:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0014_auto_20191110_1822'),
]
operations = [
migrations.AlterField(
model_name='image',
name='place',
field=models.ManyToManyField(blank=True, related_name='images', to='rental.Place'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-11-10 18:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rental', '0015_auto_20191110_1825'),
]
operations = [
migrations.RenameField(
model_name='image',
old_name='img',
new_name='url',
),
]

View file

@ -0,0 +1,28 @@
# Generated by Django 2.2.6 on 2019-11-11 08:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0016_auto_20191110_1826'),
]
operations = [
migrations.RemoveField(
model_name='image',
name='place',
),
migrations.AddField(
model_name='place',
name='images',
field=models.ManyToManyField(blank=True, null=True, related_name='places', to='rental.Image'),
),
migrations.AddField(
model_name='place',
name='thumbnail',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='rental.Image'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-11-11 09:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0017_auto_20191111_0855'),
]
operations = [
migrations.RenameField(
model_name='image',
old_name='url',
new_name='img',
),
migrations.AlterField(
model_name='place',
name='images',
field=models.ManyToManyField(blank=True, related_name='places', to='rental.Image'),
),
]

View file

@ -0,0 +1,26 @@
# Generated by Django 2.2.6 on 2019-11-11 10:20
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('rental', '0018_auto_20191111_0912'),
]
operations = [
migrations.AddField(
model_name='reservation',
name='end',
field=models.DateField(default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='reservation',
name='start',
field=models.DateField(default=django.utils.timezone.now),
preserve_default=False,
),
]

View file

@ -0,0 +1,21 @@
# Generated by Django 2.2.6 on 2019-11-11 10:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rental', '0019_auto_20191111_1020'),
]
operations = [
migrations.RemoveField(
model_name='reservation',
name='end',
),
migrations.RemoveField(
model_name='reservation',
name='start',
),
]

View file

@ -0,0 +1,26 @@
# Generated by Django 2.2.6 on 2019-11-11 11:12
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('rental', '0020_auto_20191111_1038'),
]
operations = [
migrations.AddField(
model_name='reservation',
name='end',
field=models.DateField(default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='reservation',
name='start',
field=models.DateField(default=django.utils.timezone.now),
preserve_default=False,
),
]

View file

@ -0,0 +1,19 @@
# Generated by Django 2.2.6 on 2019-11-11 12:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rental', '0021_auto_20191111_1112'),
]
operations = [
migrations.AlterField(
model_name='reservation',
name='place',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rental.Place'),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.7 on 2019-12-03 12:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0022_auto_20191111_1211'),
]
operations = [
migrations.AddField(
model_name='reservation',
name='quotation',
field=models.DecimalField(decimal_places=2, max_digits=6, null=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.7 on 2019-12-03 12:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rental', '0023_reservation_quotation'),
]
operations = [
migrations.RenameField(
model_name='reservation',
old_name='quotation',
new_name='price',
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 3.0 on 2019-12-06 12:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0024_auto_20191203_1227'),
]
operations = [
migrations.AddField(
model_name='place',
name='calendar',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='guest',
name='phone',
field=models.CharField(blank=True, max_length=30),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0 on 2019-12-06 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0025_auto_20191206_1215'),
]
operations = [
migrations.AlterField(
model_name='place',
name='calendar',
field=models.CharField(blank=True, max_length=350, null=True),
),
]

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0 on 2019-12-09 18:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rental', '0026_auto_20191206_1217'),
]
operations = [
migrations.AlterField(
model_name='guest',
name='email',
field=models.EmailField(max_length=254),
),
]

View file

View file

@ -1,7 +1,10 @@
amqp==2.5.2
asgiref==3.2.3
astroid==2.3.3
beautifulsoup4==4.8.1
billiard==3.6.1.0
cachetools==3.1.1
celery==4.4.0
certifi==2019.11.28
chardet==3.0.4
dj-database-url==0.5.0
@ -14,7 +17,9 @@ google-auth-oauthlib==0.4.1
gunicorn==20.0.4
httplib2==0.14.0
idna==2.8
importlib-metadata==1.2.0
isort==4.3.21
kombu==4.6.7
lazy-object-proxy==1.4.3
mccabe==0.6.1
oauth2client==4.1.3
@ -35,6 +40,7 @@ sqlparse==0.3.0
typed-ast==1.4.0
uritemplate==3.0.0
urllib3==1.25.7
vine==1.3.0
whitenoise==4.1.4
wrapt==1.11.2
zipp==0.6.0

View file

@ -7,25 +7,25 @@ ADMINS = [
("VillaFleurie", "location.villafleurie@gmail.com")
]
# os.environ.get('SECRET_KEY')
SECRET_KEY = "q00_4wqdc^n=7)p2lm)!gy&fms8md_b4#1aqysllvqq==2c9!$"
SECRET_KEY = os.environ.get('SECRET_KEY')
if os.environ.get('ENV') == 'PRODUCTION':
DEBUG = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'NAME': 'villafleurie',
'USER': 'villafleurie',
'PASSWORD': os.environ.get("PASSWORD"),
'HOST': 'db',
'PORT': '5432',
'ATOMIC_REQUESTS': True
}
}
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS')
ALLOWED_HOSTS = [os.environ.get('ALLOWED_HOSTS')]
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
# CSRF_COOKIE_SECURE = True
# SESSION_COOKIE_SECURE = True
CONN_MAX_AGE = 500
LOGGING = {
@ -65,10 +65,10 @@ else:
}
STATICFILES_DIRS = [os.path.join(BASE_DIR, "rental", "static", "rental"), ]
ALLOWED_HOSTS = [
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost'
]
]
INSTALLED_APPS = [
'django.contrib.admin',