From 6261a6460d3fd59b416386eaabb9a7c3bf792833 Mon Sep 17 00:00:00 2001 From: Roman Vynnytskyi Date: Fri, 6 Dec 2024 15:18:46 +0200 Subject: [PATCH] configure settings and add .env file --- ..._genre_alter_movie_description_and_more.py | 81 +++++++++++++++++++ cinema_service/settings.py | 10 +-- requirements.txt | 2 +- 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 cinema/migrations/0002_actor_cinemahall_genre_alter_movie_description_and_more.py diff --git a/cinema/migrations/0002_actor_cinemahall_genre_alter_movie_description_and_more.py b/cinema/migrations/0002_actor_cinemahall_genre_alter_movie_description_and_more.py new file mode 100644 index 000000000..b350fc366 --- /dev/null +++ b/cinema/migrations/0002_actor_cinemahall_genre_alter_movie_description_and_more.py @@ -0,0 +1,81 @@ +# Generated by Django 4.1 on 2024-12-06 13:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("cinema", "0001_initial"), + ] + + operations = [ + migrations.CreateModel( + name="Actor", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("first_name", models.CharField(max_length=63)), + ("last_name", models.CharField(max_length=63)), + ], + ), + migrations.CreateModel( + name="CinemaHall", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=63)), + ("rows", models.IntegerField()), + ("seats_in_row", models.IntegerField()), + ], + ), + migrations.CreateModel( + name="Genre", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=63, unique=True)), + ], + ), + migrations.AlterField( + model_name="movie", + name="description", + field=models.CharField(max_length=255, null=True), + ), + migrations.AlterField( + model_name="movie", + name="title", + field=models.CharField(max_length=63), + ), + migrations.AddField( + model_name="movie", + name="actors", + field=models.ManyToManyField(related_name="movies", to="cinema.actor"), + ), + migrations.AddField( + model_name="movie", + name="genres", + field=models.ManyToManyField(related_name="movies", to="cinema.genre"), + ), + ] diff --git a/cinema_service/settings.py b/cinema_service/settings.py index def98786c..5b739e132 100644 --- a/cinema_service/settings.py +++ b/cinema_service/settings.py @@ -9,7 +9,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ - +import os from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -20,14 +20,12 @@ # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = ( - "django-insecure-ru6ndfka@95_(lysua8yhdjq@vpiqgv3yru4r)q3h4_u8x7dfy" -) +SECRET_KEY = os.getenv("DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] # Application definition diff --git a/requirements.txt b/requirements.txt index 99938e15f..56e135547 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ flake8-quotes==3.3.1 flake8-variables-names==0.0.5 pep8-naming==0.13.2 django-debug-toolbar==3.2.4 -djangorestframework==3.13.1 +djangorestframework==3.13.1 \ No newline at end of file