暫無描述

tum 70dfc9cb35 profile form 3 月之前
admin_frontend 70dfc9cb35 profile form 3 月之前
api a5d82c3daa first commit 3 月之前
billing 74ff3a8308 permissions 3 月之前
cms a5d82c3daa first commit 3 月之前
ecoloop 2fc72766d2 translate 3 月之前
frontend a5d82c3daa first commit 3 月之前
locale 2fc72766d2 translate 3 月之前
orgs 70dfc9cb35 profile form 3 月之前
posts a5d82c3daa first commit 3 月之前
public_frontend 70dfc9cb35 profile form 3 月之前
recycle_core 70dfc9cb35 profile form 3 月之前
settings a5d82c3daa first commit 3 月之前
static 13efd6cd68 services 3 月之前
templates a5d82c3daa first commit 3 月之前
theme 0a495327f3 controller 3 月之前
translations 2fc72766d2 translate 3 月之前
.gitignore a5d82c3daa first commit 3 月之前
AGENTS.md a5d82c3daa first commit 3 月之前
Dockerfile 2fc72766d2 translate 3 月之前
Procfile.tailwind a5d82c3daa first commit 3 月之前
README.md a5d82c3daa first commit 3 月之前
docker-compose.yml 2fc72766d2 translate 3 月之前
er.dot 623545550f controller 3 月之前
erd.pdf 623545550f controller 3 月之前
erd.png 623545550f controller 3 月之前
manage.py a5d82c3daa first commit 3 月之前
package-lock.json 74ff3a8308 permissions 3 月之前
package.json 74ff3a8308 permissions 3 月之前
project_scopes a5d82c3daa first commit 3 月之前
requirements.txt 0a495327f3 controller 3 月之前
seq.png 623545550f controller 3 月之前
seq.txt 623545550f controller 3 月之前
seq_001.png 623545550f controller 3 月之前

README.md

Ecoloop Backend

Ecoloop is a Django + DRF backend for recycling businesses and factories to manage pickups, pricing, invoices/payouts, and a bidding marketplace for scrap lots. It supports multi-organization setups, JWT auth, and a Tailwind-powered UI layer.

Quick Start

  • Requirements: Python 3.11, Postgres, Node (for Tailwind in dev)
  • Environment: copy .env and set SECRET_KEY, DEBUG, DB_*, ALLOWED_HOSTS
  • Run (Docker): docker-compose up --build (web on http://localhost:8024)
  • Run (local):
    • python manage.py migrate
    • python manage.py runserver
    • Optional demo: python manage.py seed_ecoloop
  • API docs: Swagger UI at /api/schema/swagger-ui/

Project Scopes (Summary)

  • Core operations: customers, sites, service agreements, materials, units; pickup lifecycle (request → schedule/assign → collect → weigh ticket → complete).
  • Pricing & finance: org/customer price lists (buy/sell), invoice generation from weigh tickets, payments, and payouts for buy-priced materials.
  • Bidding marketplace: factories post scrap listings (open/invite-only), recyclers bid with min-increment/reserve; award creates a pickup order.
  • Users & portal: roles (owner, manager, driver, customer, auditor); JWT auth; customer/driver-facing endpoints for assignments and status.
  • Compliance & docs: upload/attach documents (proofs, photos, certificates); audit logs for key state changes.
  • Reporting: benefit leaderboards and volume/revenue summaries (period filters).
  • Multi-org & locale: organization scoping, currency codes (THB/USD), units (kg/lb); env-driven config.

Key Commands

  • python manage.py migrate — apply DB migrations
  • python manage.py seed_ecoloop — seed demo org, users, materials, pickup, weigh ticket, invoice, listing/bid
  • python manage.py ecoloop_auto_close_award — auto-close/award expired listings

Multisite (Local Testing)

  • Purpose: Serve multiple sites on one codebase using Django Sites.
  • Config:
    • Enabled in ecoloop/settings.py via django.contrib.sites and SITE_ID.
    • .env includes defaults for local hosts: ALLOWED_HOSTS=localhost,127.0.0.1,.lvh.me
    • .env CSRF for Docker port: CSRF_TRUSTED_ORIGINS=http://localhost:8024,http://*.lvh.me:8024
  • Run:
    • python manage.py migrate (applies Sites tables)
    • In Admin → Sites, add domains like alpha.lvh.me and beta.lvh.me.
    • Visit http://alpha.lvh.me:8024 and http://beta.lvh.me:8024.
    • Attach site-specific content in apps (e.g., CMS) by filtering on get_current_site(request) or adding a ForeignKey to Site.

Structure

  • ecoloop/ settings and URLs; api/ public endpoints; recycle_core/ domain models/APIs
  • Assets: templates/, static/, media/; Entrypoints: manage.py, docker-compose.yml, Dockerfile