diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d3a85fe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Базовый образ +FROM python:3.11 + +# Устанавливаем рабочую директорию внутри контейнера +WORKDIR /app + +# Копируем зависимости +COPY requirements.txt . + +# Устанавливаем зависимости +RUN pip install --no-cache-dir -r requirements.txt + +# Копируем все файлы проекта +COPY . . + +# Открываем порт (опционально, если хочешь) +EXPOSE 8000 + +# Запускаем сервер +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/api/__pycache__/__init__.cpython-311.pyc b/api/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..d42bfee Binary files /dev/null and b/api/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/__pycache__/admin.cpython-311.pyc b/api/__pycache__/admin.cpython-311.pyc new file mode 100644 index 0000000..8f3745e Binary files /dev/null and b/api/__pycache__/admin.cpython-311.pyc differ diff --git a/api/__pycache__/apps.cpython-311.pyc b/api/__pycache__/apps.cpython-311.pyc new file mode 100644 index 0000000..e265c33 Binary files /dev/null and b/api/__pycache__/apps.cpython-311.pyc differ diff --git a/api/__pycache__/models.cpython-311.pyc b/api/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..19fbe5d Binary files /dev/null and b/api/__pycache__/models.cpython-311.pyc differ diff --git a/api/__pycache__/serializers.cpython-311.pyc b/api/__pycache__/serializers.cpython-311.pyc new file mode 100644 index 0000000..bd8104c Binary files /dev/null and b/api/__pycache__/serializers.cpython-311.pyc differ diff --git a/api/__pycache__/urls.cpython-311.pyc b/api/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..dd5424c Binary files /dev/null and b/api/__pycache__/urls.cpython-311.pyc differ diff --git a/api/__pycache__/urls.cpython-313.pyc b/api/__pycache__/urls.cpython-313.pyc index 39809bb..a73920c 100644 Binary files a/api/__pycache__/urls.cpython-313.pyc and b/api/__pycache__/urls.cpython-313.pyc differ diff --git a/api/__pycache__/views.cpython-311.pyc b/api/__pycache__/views.cpython-311.pyc new file mode 100644 index 0000000..7f2680f Binary files /dev/null and b/api/__pycache__/views.cpython-311.pyc differ diff --git a/api/__pycache__/views.cpython-313.pyc b/api/__pycache__/views.cpython-313.pyc index 8c1e868..f1db0f6 100644 Binary files a/api/__pycache__/views.cpython-313.pyc and b/api/__pycache__/views.cpython-313.pyc differ diff --git a/api/migrations/__pycache__/0001_initial.cpython-311.pyc b/api/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..dd81974 Binary files /dev/null and b/api/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/api/migrations/__pycache__/0002_prediction_user_userprediction_delete_todo.cpython-311.pyc b/api/migrations/__pycache__/0002_prediction_user_userprediction_delete_todo.cpython-311.pyc new file mode 100644 index 0000000..f5a1716 Binary files /dev/null and b/api/migrations/__pycache__/0002_prediction_user_userprediction_delete_todo.cpython-311.pyc differ diff --git a/api/migrations/__pycache__/__init__.cpython-311.pyc b/api/migrations/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..54b62c5 Binary files /dev/null and b/api/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/api/urls.py b/api/urls.py index 248713c..c256ed2 100644 --- a/api/urls.py +++ b/api/urls.py @@ -6,5 +6,5 @@ urlpatterns = [ path('predictions', PredictionCreateView.as_view(), name='create_prediction'), path('predictions', PredictionListView.as_view(), name='get_predictions'), path('predictions/', PredictionDeleteView.as_view(), name='delete_prediction'), - path('api/token/', obtain_auth_token), + path('token/', obtain_auth_token), ] diff --git a/db.sqlite3 b/db.sqlite3 index 5be43ec..a39dc9f 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..aebbcfe --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,21 @@ +version: '3.9' + +services: + web: + build: . + command: python manage.py runserver 0.0.0.0:8000 + ports: + - "8000:8000" + volumes: + - .:/app + depends_on: + - db + + db: + image: postgres:14 + environment: + POSTGRES_DB: testapi + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6aae030 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +Django>=4.0,<5.0 +djangorestframework +djangorestframework-simplejwt +psycopg2-binary +drf-spectacular +requests \ No newline at end of file diff --git a/testapi/__pycache__/__init__.cpython-311.pyc b/testapi/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e5a3d9d Binary files /dev/null and b/testapi/__pycache__/__init__.cpython-311.pyc differ diff --git a/testapi/__pycache__/settings.cpython-311.pyc b/testapi/__pycache__/settings.cpython-311.pyc new file mode 100644 index 0000000..9fd7f24 Binary files /dev/null and b/testapi/__pycache__/settings.cpython-311.pyc differ diff --git a/testapi/__pycache__/settings.cpython-313.pyc b/testapi/__pycache__/settings.cpython-313.pyc index 6f91e0b..4edb2ac 100644 Binary files a/testapi/__pycache__/settings.cpython-313.pyc and b/testapi/__pycache__/settings.cpython-313.pyc differ diff --git a/testapi/__pycache__/urls.cpython-311.pyc b/testapi/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..4f2347b Binary files /dev/null and b/testapi/__pycache__/urls.cpython-311.pyc differ diff --git a/testapi/__pycache__/urls.cpython-313.pyc b/testapi/__pycache__/urls.cpython-313.pyc index 6930a4d..37a389d 100644 Binary files a/testapi/__pycache__/urls.cpython-313.pyc and b/testapi/__pycache__/urls.cpython-313.pyc differ diff --git a/testapi/__pycache__/wsgi.cpython-311.pyc b/testapi/__pycache__/wsgi.cpython-311.pyc new file mode 100644 index 0000000..e240df0 Binary files /dev/null and b/testapi/__pycache__/wsgi.cpython-311.pyc differ diff --git a/testapi/settings.py b/testapi/settings.py index 641c282..89ff0c7 100644 --- a/testapi/settings.py +++ b/testapi/settings.py @@ -78,13 +78,17 @@ WSGI_APPLICATION = 'testapi.wsgi.application' # https://docs.djangoproject.com/en/5.1/ref/settings/#databases DATABASES = { + # 'default': { + # 'ENGINE': 'django.db.backends.postgresql', + # 'NAME': 'drfapi', # Your database name + # 'USER': 'postgres', # Your PostgreSQL username + # 'PASSWORD': '1235', # Your PostgreSQL password + # 'HOST': 'localhost', # Or your DB server's IP + # 'PORT': '5432', # Default PostgreSQL port + # } 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'drfapi', # Your database name - 'USER': 'postgres', # Your PostgreSQL username - 'PASSWORD': '1235', # Your PostgreSQL password - 'HOST': 'localhost', # Or your DB server's IP - 'PORT': '5432', # Default PostgreSQL port + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', } }