update dependencies

This commit is contained in:
Diego Calvo
2025-07-21 15:00:49 +02:00
parent 451cbe2a6a
commit 61c68a42ce
5 changed files with 39 additions and 46 deletions

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.6.15

View File

@@ -24,7 +24,6 @@ This README aims to document functionality of backend as well as required steps
- [Development Utils](#development-utils) - [Development Utils](#development-utils)
- [Fake product data generation](#fake-product-data-generation) - [Fake product data generation](#fake-product-data-generation)
## First Steps ## First Steps
- Clone repository: - Clone repository:
@@ -36,6 +35,8 @@ This README aims to document functionality of backend as well as required steps
docker run --name postgis -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgis/postgis docker run --name postgis -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgis/postgis
``` ```
If you are in ARM64 use the image `imresamu/postgis:17-3.5.2-alpine3.21`
- Create file `.env` from `example.env` and populate fields correctly - Create file `.env` from `example.env` and populate fields correctly
From inside the project's folder: From inside the project's folder:
@@ -49,20 +50,16 @@ python manage.py migrate
- Start server in development mode: `python manage.py runserver` - Start server in development mode: `python manage.py runserver`
### Load Location Data ### Load Location Data
To load initial location data use: `python manage.py loadgisdata` To load initial location data use: `python manage.py loadgisdata`
### Load Taxonomy Data ### Load Taxonomy Data
This data serves as initial Tags This data serves as initial Tags
To load initial set of tags: `python manage.py addtaxonomy` To load initial set of tags: `python manage.py addtaxonomy`
## Social Auth ## Social Auth
Use your credentials from social media network to create acount and log in. Use your credentials from social media network to create acount and log in.
@@ -108,14 +105,12 @@ Queryset: all Company instances, validated or not
Permissions: only accesible to authenticated users with role `SITE_ADMIN` Permissions: only accesible to authenticated users with role `SITE_ADMIN`
### random_company_sample ### random_company_sample
Method view that returns a randome sample of companies Method view that returns a randome sample of companies
By default it returns 6 instances, but can be customized through parameter `size` By default it returns 6 instances, but can be customized through parameter `size`
## Product Endpoints ## Product Endpoints
### ProductViewSet ### ProductViewSet
@@ -140,7 +135,6 @@ Permissions:
- anon user: no access - anon user: no access
- auth user: full access - auth user: full access
### AdminProductsViewSet ### AdminProductsViewSet
Endpoint url: `/api/v1/admin_products/` Endpoint url: `/api/v1/admin_products/`
@@ -174,7 +168,6 @@ Parameters:
- price_min: int - price_min: int
- price_max: int - price_max: int
### purchase_email [POST] ### purchase_email [POST]
Endpoint url: `/api/v1/purchase_email/` Endpoint url: `/api/v1/purchase_email/`
@@ -209,14 +202,12 @@ Ednpoint url: `/api/v1/user/change_password/<int:pk>/`
Permissions: only accessible for your own user instance Permissions: only accessible for your own user instance
### UpdateUserView ### UpdateUserView
Endpoint url: `/api/v1/user/update/` Endpoint url: `/api/v1/user/update/`
Permissions: only accessible for your own user instance Permissions: only accessible for your own user instance
### create_company_user [POST] ### create_company_user [POST]
Edndpoint: `/api/v1/create_company_user/` Edndpoint: `/api/v1/create_company_user/`
@@ -250,11 +241,12 @@ Creation:
- endpoint: `/api/v1/users/` - endpoint: `/api/v1/users/`
- method: GET - method: GET
- payload: - payload:
```json ```json
{ {
"email": "test@email.com", "email": "test@email.com",
"full_name": "TEST NAME", "full_name": "TEST NAME",
"password": "VENTILADOR2ES1234499.89", "password": "VENTILADOR2ES1234499.89"
} }
``` ```
@@ -263,6 +255,7 @@ Change password:
- endpoint: api/v1/user/change_password/{user.pk}/ - endpoint: api/v1/user/change_password/{user.pk}/
- method: POST - method: POST
- payload: - payload:
```json ```json
{ {
"old_password": "my_old_password", "old_password": "my_old_password",
@@ -272,33 +265,34 @@ Change password:
``` ```
Update user profile: Update user profile:
- endpoint: api/v1/users/<int:pk>/ - endpoint: api/v1/users/<int:pk>/
- method: PUT - method: PUT
- payload: - payload:
```json ```json
{ {
"email": "new_user@email.com", "email": "new_user@email.com",
"full_name": "Mr. TEST NAME", "full_name": "Mr. TEST NAME"
} }
``` ```
### Authentication ### Authentication
Implemented using `djangorestframework-simplejwt` Implemented using `djangorestframework-simplejwt`
New token pair endpoint: `/api/v1/token/` New token pair endpoint: `/api/v1/token/`
Response: Response:
```json ```json
{ {
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYxMjI3MTcwNSwianRpIjoiZDU4YTgzYzFkYzFkNDI5MTljMGQ0NzcxNzljNzUxYTQiLCJ1c2VyX2lkIjo4fQ.yln80W5lONSyHwwqF4qBBHteqLuRfdLLWuaQANr_vxc", "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYxMjI3MTcwNSwianRpIjoiZDU4YTgzYzFkYzFkNDI5MTljMGQ0NzcxNzljNzUxYTQiLCJ1c2VyX2lkIjo4fQ.yln80W5lONSyHwwqF4qBBHteqLuRfdLLWuaQANr_vxc",
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjEyMTg4OTA1LCJqdGkiOiIzNGIxMzM3NmU4MWI0OWY5YjU3ZmUxM2M5NThmZWZkYiIsInVzZXJfaWQiOjh9.aRDCUvKj7LCvixjPLC9ghy0h7rfRwR6Lo3A7HX4kSHE" "access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjEyMTg4OTA1LCJqdGkiOiIzNGIxMzM3NmU4MWI0OWY5YjU3ZmUxM2M5NThmZWZkYiIsInVzZXJfaWQiOjh9.aRDCUvKj7LCvixjPLC9ghy0h7rfRwR6Lo3A7HX4kSHE"
} }
``` ```
Refresh expired token endpoint: `/api/v1/token/refresh/`
Refresh expired token endpoint: `/api/v1/token/refresh/`
### Users ### Users
@@ -311,30 +305,28 @@ Authenticated users cannot create new users
User are active by default User are active by default
To create user: To create user:
```json ```json
{ {
"email": "test_user23@mail.com", "email": "test_user23@mail.com",
"full_name": "Mr Test User", "full_name": "Mr Test User",
"password": "wqertewqr32qrewqr", "password": "wqertewqr32qrewqr",
"provider": "TWITTER" "provider": "TWITTER"
} }
``` ```
## History Endpoints ## History Endpoints
Endpoint url: `/api/v1/history/`: Endpoint url: `/api/v1/history/`:
Historical records about product importation Historical records about product importation
## Stats Endpoints ## Stats Endpoints
Endpoint url: `/api/v1/stats/` Endpoint url: `/api/v1/stats/`
logs about user interaction with products links logs about user interaction with products links
## Location Endpoints ## Location Endpoints
Location ednpoints: Location ednpoints:
@@ -363,21 +355,19 @@ Credential format:
```json ```json
{ {
"key": "qwerweqr", "key": "qwerweqr",
"secret": "asdfsa", "secret": "asdfsa"
} }
``` ```
Method: `utils.woocommerce.migrate_shop_products` Method: `utils.woocommerce.migrate_shop_products`
## Product Search ## Product Search
Endpoint: `/api/v1/product_search/` Endpoint: `/api/v1/product_search/`
Query parameters: Query parameters:
- `q`: text from the search input box - `q`: text from the search input box
Response format: Response format:
@@ -385,19 +375,18 @@ Response format:
{ {
"filters": { "filters": {
"tags": { "tags": {
"singles": ["tag1", "tag2"], // for tags that aren't nested "singles": ["tag1", "tag2"], // for tags that aren't nested
"entry_1": ["subtag_1", "subtag_2"], // for tree tags like entry_1/subtag_1 "entry_1": ["subtag_1", "subtag_2"], // for tree tags like entry_1/subtag_1
"entry_2": ["subtag_1", "subtag_2"] // one per penultimate tag in tree "entry_2": ["subtag_1", "subtag_2"] // one per penultimate tag in tree
}, },
"attributes": { "attributes": {
"singles": ["tag1", "tag2"], // for tags that aren't nested "singles": ["tag1", "tag2"], // for tags that aren't nested
"entry_1": ["subtag_1", "subtag_2"], // for tree tags like entry_1/subtag_1 "entry_1": ["subtag_1", "subtag_2"], // for tree tags like entry_1/subtag_1
"entry_2": ["subtag_1", "subtag_2"] // one per penultimate tag in tree "entry_2": ["subtag_1", "subtag_2"] // one per penultimate tag in tree
}, }
}, },
"products" : [], // list of serialized instances, in order of relevancy "products": [] // list of serialized instances, in order of relevancy
} }
``` ```
Available query parameters: Available query parameters:
@@ -411,10 +400,8 @@ Available query parameters:
- tags: string - tags: string
- order: string (newest/oldest) - order: string (newest/oldest)
Check out `products.tests.ProductSearchTest` for a practical case. Check out `products.tests.ProductSearchTest` for a practical case.
## Massive Data Load Endpoints ## Massive Data Load Endpoints
### COOP and Managing User Data Load ### COOP and Managing User Data Load
@@ -451,7 +438,6 @@ Optional:
`sudo apt install libmaxminddb0 libmaxminddb-dev mmdb-bin` `sudo apt install libmaxminddb0 libmaxminddb-dev mmdb-bin`
## Tags ## Tags
Both `Company` and `Product` models make use of tags. Both `Company` and `Product` models make use of tags.
@@ -461,13 +447,11 @@ Both `Company` and `Product` models make use of tags.
To create the initial set of tags, we can use the `addtaxonomy` management command. To create the initial set of tags, we can use the `addtaxonomy` management command.
Reads the data from `datasets/shop-taxonomy.es-ES.txt` which is from google shopping Reads the data from `datasets/shop-taxonomy.es-ES.txt` which is from google shopping
### Top-level tags ### Top-level tags
In order to extract the top level tags for use as categories, we can use the `extractparenttas` management command. In order to extract the top level tags for use as categories, we can use the `extractparenttas` management command.
It saves the results to `datasets/top_tags.txt` It saves the results to `datasets/top_tags.txt`
## Development Utils ## Development Utils
### Fake product data generation ### Fake product data generation

View File

@@ -1,5 +1,10 @@
from back_latienda.settings.base import * from back_latienda.settings.base import *
from datetime import timedelta from datetime import timedelta
import os
GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')
GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True

View File

@@ -25,4 +25,7 @@ SOCIAL_AUTH_FACEBOOK_SECRET = ''
DRFSO2_PROPRIETARY_BACKEND_NAME = '' # E.g. Facebook DRFSO2_PROPRIETARY_BACKEND_NAME = '' # E.g. Facebook
DRFSO2_URL_NAMESPACE = '' # namespace for reversing URLs DRFSO2_URL_NAMESPACE = '' # namespace for reversing URLs
GOOGLE_CLIENT_ID='' GOOGLE_CLIENT_ID=''
FACEBOOK_ID='' FACEBOOK_ID=''
GDAL_LIBRARY_PATH=
GEOS_LIBRARY_PATH=

View File

@@ -1,11 +1,11 @@
Django==2.2.17 Django==2.2.17
psycopg2-binary==2.8.6 psycopg2-binary==2.8.6
djangorestframework==3.12.2 djangorestframework==3.12.2
djangorestframework-simplejwt==4.6.0 djangorestframework-simplejwt==4.4.0
factory-boy==3.1.0 factory-boy==3.1.0
django-dotenv==1.4.2 django-dotenv==1.4.2
django-filter==2.4.0 django-filter==2.4.0
-e git://github.com/darklow/django-suit/@v2#egg=django-suit git+https://github.com/darklow/django-suit@v2#egg=django-suit
django-cors-headers==3.5.0 django-cors-headers==3.5.0
django-taggit-serializer==0.1.7 django-taggit-serializer==0.1.7
django-tagulous==1.1.0 django-tagulous==1.1.0