diff --git a/back/.gitignore b/back/.gitignore index 621ddc5..78c7392 100644 --- a/back/.gitignore +++ b/back/.gitignore @@ -86,4 +86,6 @@ __pycache__/ local_settings.py .env -db.sqlite3 \ No newline at end of file +db.sqlite3 + +.pgpass \ No newline at end of file diff --git a/back/.pgpass.example b/back/.pgpass.example new file mode 100644 index 0000000..50e4efa --- /dev/null +++ b/back/.pgpass.example @@ -0,0 +1 @@ +#hostname:port:database:username:password \ No newline at end of file diff --git a/back/api/settings.py b/back/api/settings.py index 2d14f31..78bdf0e 100644 --- a/back/api/settings.py +++ b/back/api/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'rest_framework', ] MIDDLEWARE = [ @@ -74,9 +75,13 @@ WSGI_APPLICATION = 'api.wsgi.application' # https://docs.djangoproject.com/en/5.0/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + "default": { + "ENGINE": "django.db.backends.postgresql", + "OPTIONS": { + # in ~/.pg_service.conf + 'service': 'to_inventory_db', + "passfile": ".pgpass", + }, } } diff --git a/back/poetry.lock b/back/poetry.lock index a695487..bdd908d 100644 --- a/back/poetry.lock +++ b/back/poetry.lock @@ -48,6 +48,20 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""} argon2 = ["argon2-cffi (>=19.1.0)"] bcrypt = ["bcrypt"] +[[package]] +name = "django-filter" +version = "24.2" +description = "Django-filter is a reusable Django application for allowing users to filter querysets dynamically." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django-filter-24.2.tar.gz", hash = "sha256:48e5fc1da3ccd6ca0d5f9bb550973518ce977a4edde9d2a8a154a7f4f0b9f96e"}, + {file = "django_filter-24.2-py3-none-any.whl", hash = "sha256:df2ee9857e18d38bed203c8745f62a803fa0f31688c9fe6f8e868120b1848e48"}, +] + +[package.dependencies] +Django = ">=4.2" + [[package]] name = "djangorestframework" version = "3.15.1" @@ -62,6 +76,21 @@ files = [ [package.dependencies] django = ">=3.0" +[[package]] +name = "markdown" +version = "3.6" +description = "Python implementation of John Gruber's Markdown." +optional = false +python-versions = ">=3.8" +files = [ + {file = "Markdown-3.6-py3-none-any.whl", hash = "sha256:48f276f4d8cfb8ce6527c8f79e2ee29708508bf4d40aa410fbc3b4ee832c850f"}, + {file = "Markdown-3.6.tar.gz", hash = "sha256:ed4f41f6daecbeeb96e576ce414c41d2d876daa9a16cb35fa8ed8c2ddfad0224"}, +] + +[package.extras] +docs = ["mdx-gh-links (>=0.2)", "mkdocs (>=1.5)", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-nature (>=0.6)", "mkdocs-section-index", "mkdocstrings[python]"] +testing = ["coverage", "pyyaml"] + [[package]] name = "mslex" version = "1.2.0" @@ -101,6 +130,28 @@ files = [ [package.extras] test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] +[[package]] +name = "psycopg2" +version = "2.9.9" +description = "psycopg2 - Python-PostgreSQL Database Adapter" +optional = false +python-versions = ">=3.7" +files = [ + {file = "psycopg2-2.9.9-cp310-cp310-win32.whl", hash = "sha256:38a8dcc6856f569068b47de286b472b7c473ac7977243593a288ebce0dc89516"}, + {file = "psycopg2-2.9.9-cp310-cp310-win_amd64.whl", hash = "sha256:426f9f29bde126913a20a96ff8ce7d73fd8a216cfb323b1f04da402d452853c3"}, + {file = "psycopg2-2.9.9-cp311-cp311-win32.whl", hash = "sha256:ade01303ccf7ae12c356a5e10911c9e1c51136003a9a1d92f7aa9d010fb98372"}, + {file = "psycopg2-2.9.9-cp311-cp311-win_amd64.whl", hash = "sha256:121081ea2e76729acfb0673ff33755e8703d45e926e416cb59bae3a86c6a4981"}, + {file = "psycopg2-2.9.9-cp312-cp312-win32.whl", hash = "sha256:d735786acc7dd25815e89cc4ad529a43af779db2e25aa7c626de864127e5a024"}, + {file = "psycopg2-2.9.9-cp312-cp312-win_amd64.whl", hash = "sha256:a7653d00b732afb6fc597e29c50ad28087dcb4fbfb28e86092277a559ae4e693"}, + {file = "psycopg2-2.9.9-cp37-cp37m-win32.whl", hash = "sha256:5e0d98cade4f0e0304d7d6f25bbfbc5bd186e07b38eac65379309c4ca3193efa"}, + {file = "psycopg2-2.9.9-cp37-cp37m-win_amd64.whl", hash = "sha256:7e2dacf8b009a1c1e843b5213a87f7c544b2b042476ed7755be813eaf4e8347a"}, + {file = "psycopg2-2.9.9-cp38-cp38-win32.whl", hash = "sha256:ff432630e510709564c01dafdbe996cb552e0b9f3f065eb89bdce5bd31fabf4c"}, + {file = "psycopg2-2.9.9-cp38-cp38-win_amd64.whl", hash = "sha256:bac58c024c9922c23550af2a581998624d6e02350f4ae9c5f0bc642c633a2d5e"}, + {file = "psycopg2-2.9.9-cp39-cp39-win32.whl", hash = "sha256:c92811b2d4c9b6ea0285942b2e7cac98a59e166d59c588fe5cfe1eda58e72d59"}, + {file = "psycopg2-2.9.9-cp39-cp39-win_amd64.whl", hash = "sha256:de80739447af31525feddeb8effd640782cf5998e1a4e9192ebdf829717e3913"}, + {file = "psycopg2-2.9.9.tar.gz", hash = "sha256:d1454bde93fb1e224166811694d600e746430c006fbb031ea06ecc2ea41bf156"}, +] + [[package]] name = "sqlparse" version = "0.5.0" @@ -169,4 +220,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "6efdb9c4415a13fd7937a0c572c15bd548446e6ee2d18c81c72c23d75842af08" +content-hash = "13cd55c4c735639e4184e680c963071f174e80989f8e8e66b69806f64fad4195" diff --git a/back/pyproject.toml b/back/pyproject.toml index c8ff41a..89dc8b8 100644 --- a/back/pyproject.toml +++ b/back/pyproject.toml @@ -10,6 +10,9 @@ package-mode = false python = "^3.10" Django = "^5.0.6" djangorestframework = "^3.15.1" +psycopg2 = "^2.9.9" +markdown = "^3.6" +django-filter = "^24.2" [tool.poetry.group.dev.dependencies] taskipy = "^1.12.2" diff --git a/dev.sh b/dev.sh index 01f1e55..e523c3c 100755 --- a/dev.sh +++ b/dev.sh @@ -1,3 +1,3 @@ #!/bin/bash -cd front && npm run dev & -cd back && poetry run task server & \ No newline at end of file +xterm -title "To Invetory FRONT" -e "cd front && npm run dev"& +xterm -title "To Invetory BACK" -e "cd back && poetry run task server" \ No newline at end of file