From ccc199b7a0782eded517efd88c17d5ce176a3236 Mon Sep 17 00:00:00 2001 From: rivrxsq Date: Sun, 12 Jan 2025 00:29:16 +0200 Subject: [PATCH 1/2] add resolve for a task --- .idea/.gitignore | 8 ++ .idea/highlightedFiles.xml | 17 +++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 7 + .idea/modules.xml | 8 ++ .idea/py-movie-api.iml | 23 ++++ .idea/vcs.xml | 6 + cinema/__init__.py | 0 cinema/admin.py | 3 + cinema/apps.py | 6 + cinema/migrations/0001_initial.py | 23 ++++ cinema/migrations/__init__.py | 0 cinema/models.py | 7 + cinema/serializers.py | 7 + cinema/tests.py | 3 + cinema/urls.py | 10 ++ cinema/views.py | 36 +++++ cinema_project/__init__.py | 0 cinema_project/asgi.py | 16 +++ cinema_project/settings.py | 127 ++++++++++++++++++ cinema_project/urls.py | 22 +++ cinema_project/wsgi.py | 16 +++ db.sqlite3 | Bin 0 -> 135168 bytes manage.py | 22 +++ 24 files changed, 373 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/highlightedFiles.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/py-movie-api.iml create mode 100644 .idea/vcs.xml create mode 100644 cinema/__init__.py create mode 100644 cinema/admin.py create mode 100644 cinema/apps.py create mode 100644 cinema/migrations/0001_initial.py create mode 100644 cinema/migrations/__init__.py create mode 100644 cinema/models.py create mode 100644 cinema/serializers.py create mode 100644 cinema/tests.py create mode 100644 cinema/urls.py create mode 100644 cinema/views.py create mode 100644 cinema_project/__init__.py create mode 100644 cinema_project/asgi.py create mode 100644 cinema_project/settings.py create mode 100644 cinema_project/urls.py create mode 100644 cinema_project/wsgi.py create mode 100644 db.sqlite3 create mode 100644 manage.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..13566b81b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/highlightedFiles.xml b/.idea/highlightedFiles.xml new file mode 100644 index 000000000..f9d3c5e1e --- /dev/null +++ b/.idea/highlightedFiles.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..a6218fed0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..7daac3b4b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/py-movie-api.iml b/.idea/py-movie-api.iml new file mode 100644 index 000000000..f912f250f --- /dev/null +++ b/.idea/py-movie-api.iml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/cinema/__init__.py b/cinema/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/cinema/admin.py b/cinema/admin.py new file mode 100644 index 000000000..8c38f3f3d --- /dev/null +++ b/cinema/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cinema/apps.py b/cinema/apps.py new file mode 100644 index 000000000..0ad90019d --- /dev/null +++ b/cinema/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CinemaConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'cinema' diff --git a/cinema/migrations/0001_initial.py b/cinema/migrations/0001_initial.py new file mode 100644 index 000000000..c24c7d1b5 --- /dev/null +++ b/cinema/migrations/0001_initial.py @@ -0,0 +1,23 @@ +# Generated by Django 5.1.4 on 2025-01-11 22:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Movie', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('description', models.TextField()), + ('duration', models.IntegerField()), + ], + ), + ] diff --git a/cinema/migrations/__init__.py b/cinema/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/cinema/models.py b/cinema/models.py new file mode 100644 index 000000000..9f6e6d451 --- /dev/null +++ b/cinema/models.py @@ -0,0 +1,7 @@ +from django.db import models + + +class Movie(models.Model): + title = models.CharField(max_length=255) + description = models.TextField() + duration = models.IntegerField() diff --git a/cinema/serializers.py b/cinema/serializers.py new file mode 100644 index 000000000..9e97be4d7 --- /dev/null +++ b/cinema/serializers.py @@ -0,0 +1,7 @@ +from rest_framework import serializers +from .models import Movie + +class MovieSerializer(serializers.ModelSerializer): + class Meta: + model = Movie + fields = ['title', 'description', 'duration'] \ No newline at end of file diff --git a/cinema/tests.py b/cinema/tests.py new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ b/cinema/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cinema/urls.py b/cinema/urls.py new file mode 100644 index 000000000..bdf563de4 --- /dev/null +++ b/cinema/urls.py @@ -0,0 +1,10 @@ +from django.urls import path +from cinema.views import movie_list, movie_detail + + +app_name = 'cinema' + +urlpatterns = [ + path('movies/', movie_list), + path('movies//', movie_detail), +] \ No newline at end of file diff --git a/cinema/views.py b/cinema/views.py new file mode 100644 index 000000000..db67163bf --- /dev/null +++ b/cinema/views.py @@ -0,0 +1,36 @@ +from rest_framework.response import Response +from rest_framework.decorators import api_view +from django.shortcuts import get_object_or_404 + +from cinema.models import Movie +from cinema.serializers import MovieSerializer + + +@api_view(['GET', 'POST']) +def movie_list(request): + if request.method == 'GET': + movies = Movie.objects.all() + serializer = MovieSerializer(movies, many=True) + return Response(serializer.data, status=200) + else: + serializer = MovieSerializer(data=request.data) + serializer.is_valid(raise_exception=True) + serializer.save() + return Response(serializer.data, status=201) + + +@api_view(['GET', 'POST']) + +def movie_detail(request, pk): + movie = get_object_or_404(Movie, pk=pk) + if request.method == 'GET': + serializer = MovieSerializer(movie) + return Response(serializer.data, status=200) + elif request.method == 'PUT': + serializer = MovieSerializer(movie, data=request.data) + serializer.is_valid(raise_exception=True) + serializer.save() + return Response(serializer.data, status=200) + elif request.method == 'DELETE': + movie.delete() + return Response(status=204) diff --git a/cinema_project/__init__.py b/cinema_project/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/cinema_project/asgi.py b/cinema_project/asgi.py new file mode 100644 index 000000000..6cd96086e --- /dev/null +++ b/cinema_project/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for cinema_project project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cinema_project.settings') + +application = get_asgi_application() diff --git a/cinema_project/settings.py b/cinema_project/settings.py new file mode 100644 index 000000000..1b6ea6596 --- /dev/null +++ b/cinema_project/settings.py @@ -0,0 +1,127 @@ +""" +Django settings for cinema_project project. + +Generated by 'django-admin startproject' using Django 3.2.16. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.2/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-m8@m2n&7=d#$ic822p!m3dp#h1_kpjy*f787!z_ouc$d&m6$s5' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'rest_framework', + 'cinema', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'cinema_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'cinema_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.2/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.2/howto/static-files/ + +STATIC_URL = '/static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/cinema_project/urls.py b/cinema_project/urls.py new file mode 100644 index 000000000..5b99dfa0b --- /dev/null +++ b/cinema_project/urls.py @@ -0,0 +1,22 @@ +"""cinema_project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.2/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('cinema/', include('cinema.urls')), +] diff --git a/cinema_project/wsgi.py b/cinema_project/wsgi.py new file mode 100644 index 000000000..7aa93b4a3 --- /dev/null +++ b/cinema_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for cinema_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cinema_project.settings') + +application = get_wsgi_application() diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..91cc0466b470947a22a7b605eeb61ec76f114f6e GIT binary patch literal 135168 zcmeI5e{3A-S;u$0>m57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file mode 100644 index 000000000..9a9d0d1b5 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cinema_project.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() From 131f896de947fd818e18d235f6126a78d0dbb9d7 Mon Sep 17 00:00:00 2001 From: rivrxsq Date: Sun, 12 Jan 2025 00:38:25 +0200 Subject: [PATCH 2/2] fix debug mode and views --- cinema/views.py | 3 +-- cinema_project/settings.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cinema/views.py b/cinema/views.py index db67163bf..648d8e3a9 100644 --- a/cinema/views.py +++ b/cinema/views.py @@ -19,8 +19,7 @@ def movie_list(request): return Response(serializer.data, status=201) -@api_view(['GET', 'POST']) - +@api_view(['GET', 'PUT', 'DELETE']) def movie_detail(request, pk): movie = get_object_or_404(Movie, pk=pk) if request.method == 'GET': diff --git a/cinema_project/settings.py b/cinema_project/settings.py index 1b6ea6596..a5029fbb6 100644 --- a/cinema_project/settings.py +++ b/cinema_project/settings.py @@ -23,7 +23,7 @@ SECRET_KEY = 'django-insecure-m8@m2n&7=d#$ic822p!m3dp#h1_kpjy*f787!z_ouc$d&m6$s5' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False ALLOWED_HOSTS = []