changes to readme, and addtaxonomy
This commit is contained in:
20
README.md
20
README.md
@@ -5,9 +5,10 @@ This README aims to document functionality of backend as well as required steps
|
||||
## Table of Contents
|
||||
|
||||
- [First Steps](#first-steps)
|
||||
- [Location Data](#location-data)
|
||||
- [Load location data](#load-location-data)
|
||||
- [Load taxonomy data](#load-taxonomy-data)
|
||||
- [Endpoints](#endpoints)
|
||||
- [Data Load](#data-load)
|
||||
- [Massive Data Load Endpoints](#massive-data-load-endpoints)
|
||||
- [GeoIP Setup](#geoip-setup)
|
||||
- [Development Utils](#development-utils)
|
||||
|
||||
@@ -35,13 +36,20 @@ python manage.py migrate
|
||||
|
||||
- Start server in development mode: `python manage.py runserver`
|
||||
|
||||
## Location data
|
||||
|
||||
### Load Location Data
|
||||
|
||||
To load initial location data use: `python manage.py loadgisdata`
|
||||
|
||||
|
||||
## Endpoints
|
||||
### Load Taxonomy Data
|
||||
|
||||
This data serves as initial Tags
|
||||
|
||||
To load initial set of tags: `python manage.py addtaxonomy`
|
||||
|
||||
|
||||
## Endpoints
|
||||
|
||||
### User Management
|
||||
|
||||
@@ -146,7 +154,7 @@ Endpoint url: `/api/v1/stats/`
|
||||
logs about user interaction with products links
|
||||
|
||||
|
||||
### Geo location
|
||||
## Geo location
|
||||
|
||||
Location ednpoints:
|
||||
|
||||
@@ -156,7 +164,7 @@ Location ednpoints:
|
||||
- `/api/v1/cities/`
|
||||
|
||||
|
||||
## Load Data
|
||||
## Massive Data Data Endpoints
|
||||
|
||||
|
||||
### COOP and Managing User Data Load
|
||||
|
||||
@@ -4,11 +4,12 @@ from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
|
||||
from core.models import TreeTag
|
||||
from products.models import Product
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
help = 'Load taxonomy terms into Tags'
|
||||
help = 'Load taxonomy terms into Product.tags'
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
|
||||
@@ -22,11 +23,12 @@ class Command(BaseCommand):
|
||||
print(f"Reading from {settings.TAXONOMY_FILE}")
|
||||
for line in data_file.readlines():
|
||||
try:
|
||||
tag = TreeTag.objects.create(name=line)
|
||||
# tag = TreeTag.objects.create(name=line)
|
||||
tag = Product.tags.tag_model.objects.create(name=line)
|
||||
counter += 1
|
||||
print('.', end='')
|
||||
logging.debug(f"{tag} created from {line}")
|
||||
except Exception as e:
|
||||
logging.error(f"{type(e)} while creating tags from {settings.TAXONOMY_FILE}")
|
||||
print(f"\n{counter} new TreeTag instances created")
|
||||
print(f"\nAdded {counter} Tag objects to Product.tags")
|
||||
print('Shutting down\n')
|
||||
|
||||
Reference in New Issue
Block a user