Skip to content

Latest commit

 

History

History
93 lines (69 loc) · 3.98 KB

README.md

File metadata and controls

93 lines (69 loc) · 3.98 KB

ENCYCLO-FLOWER SITE (v2)

API build SWAG build Ansible deployment codecov

Known Vulnerabilities Codacy Badge Total alerts Language grade: Python

Hello all 👋, Welcome to the Encyclo-Flower site source code. This repo contains the source code for the entire site tech stack (Backend API, Frontend, VM configuration, CI/CD automation, tests, and SWAG web server).

Site main features

  • Custom search across more then 3000 species of plants.
  • User image recognition to identify plant species.
  • Community questions and answers to help users find the right plant they looking for.
  • Community observations, users can share their observations and plant images.

Development install and run

Backend

API is running on Python 3.10
Install:
Environment variables:

  • GOOGLE_APPLICATION_CREDENTIALS - path to Google Cloud Service Account JSON file.
  • COULD_BUCKET - name of Google Cloud Storage bucket.
  • MONGO_URI - MongoDB connection string. (example: mongodb://root:example@localhost:27017/)
  • MONGO_DB_NAME - MongoDB database name. (default: dev)
  • SECRET_KEY - secret key for session. (default is generated randomly in config.py)
    To create new one run: openssl rand -hex 32
  • SMTP_USER - SMTP username (gmail address). Not mandatory.
  • SMTP_PASS - SMTP password. Not mandatory.
  • DETECT_API_SRV - URL to the detect API server. (default: http://localhost:5001)
  • TESTS_GET_PLANTS_NAMES_LIMIT - query limit for get_plants_names

Tests:

# For testing + coverage, formatting and linting:
pip install pytest pytest-cov black flake8

# pwd
# ./encyclo-flower
# enter venv
pytest -v -x -s --cov=src/api/ --cov-report xml --cov-report html:.cov_html

# exclude one test VIA command line
pytest -x -s -vv -k 'not detect_image' tests/api/

# format
black src/api/

# lint
flake8 src/api/

Run:

# enter venv
cd src/api
uvicorn main:app --reload

Dev environment

Ansible (Server automatic configuration)

sudo apt install ansible
cd server
ansible-galaxy role install -r requirements.yml
ansible-galaxy collection install -r requirements.yml
# CREATE a 'hosts' file before the next step (see `hosts.example`)
ansible-playbook -i hosts playbook.yml

Docs

learning assets

fastapi
pydantic
full-stack-fastapi-postgresql
ohad24/market