{"id":33329346,"url":"https://github.com/wyang10/openai-dbauctionsystem","last_synced_at":"2026-05-15T06:10:44.517Z","repository":{"id":324352426,"uuid":"1096801447","full_name":"wyang10/Openai-DBAuctionSystem","owner":"wyang10","description":"DBAuctionSystem — Furniture Auction Platform (Django + MySQL + Streamlit)","archived":false,"fork":false,"pushed_at":"2025-11-15T08:37:17.000Z","size":3236,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-15T10:14:47.903Z","etag":null,"topics":["auction-system","django-rest-framework","gpt","mysql","openai-api","streamlit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wyang10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-15T01:13:15.000Z","updated_at":"2025-11-15T08:37:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wyang10/Openai-DBAuctionSystem","commit_stats":null,"previous_names":["wyang10/openai-dbauctionsystem"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wyang10/Openai-DBAuctionSystem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyang10%2FOpenai-DBAuctionSystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyang10%2FOpenai-DBAuctionSystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyang10%2FOpenai-DBAuctionSystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyang10%2FOpenai-DBAuctionSystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wyang10","download_url":"https://codeload.github.com/wyang10/Openai-DBAuctionSystem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyang10%2FOpenai-DBAuctionSystem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285465933,"owners_count":27176533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auction-system","django-rest-framework","gpt","mysql","openai-api","streamlit"],"created_at":"2025-11-20T16:01:56.815Z","updated_at":"2025-11-20T16:03:36.626Z","avatar_url":"https://github.com/wyang10.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# DBAuctionSystem — Furniture Auction Platform \n# (Django + MySQL + Streamlit)\n\nAn RDBMS‑backed auction site for furniture, built with Django and MySQL. Includes a Streamlit mini‑app that translates natural‑language queries to SQL using OpenAI for exploratory data access.\n\n\u003c/div\u003e\n\n## Overview\n\n- Core: Django web app for listings, bidding, comments, watchlists; custom `User`\n- DB: MySQL (local or Cloud SQL). SQL assets (DDL/DML/Views/Triggers) included\n- NL→SQL: Streamlit app uses OpenAI to generate SQL from plain English\n\n## Features\n\n- Auth: register, login, logout; Django admin for data management\n- Listings: create listing with title/description/category/image/starting bid\n- Bidding: place bids, tracks current/highest bid, close auctions\n- Comments: add comments per listing\n- Watchlist: add/remove items; personal watchlist page\n- Categories: browse by category\n- Natural‑language SQL: Streamlit UI to query data in English and run generated SQL\n\n## Tech Stack\n\n- Python 3.9+ • Django 3.1.x\n- MySQL 8.x • PyMySQL / mysqlclient\n- Streamlit for NL→SQL demo\n- Optional: Google Cloud SQL (App Engine/Cloud Run style connection)\n\n## Repository Structure\n\n```\n\nDBAuctionSystem/\n├─ dbauction/                      # Django project\n│  ├─ manage.py\n│  ├─ dbauction/                   # Django settings/urls/wsgi\n│  ├─ dbapp/                       # App: models, views, forms, urls\n│  ├─ templates/                   # Jinja2/HTML templates\n│  ├─ static/                      # Static files (incl. admin assets)\n│  ├─ requirements.txt             # Django dependencies\n│  └─ StreamLitApp/                # Streamlit NL→SQL demo\n│     ├─ app.py\n│     └─ requirements.txt\n├─ Group9_SQL_script/              # DDL, DML, Views, Triggers\n└─ dbenv/ or auction/              # Local Python virtualenvs (optional)\n\n```\n\n## Prerequisites\n\n- Python 3.9 or newer\n- MySQL 8 (local or remote) and a database named `auction`\n- pip/venv (recommended)\n\n## Setup — Django App\n\n1) Create and activate a virtualenv\n\n```\npython3 -m venv .venv\nsource .venv/bin/activate   # Windows: .venv\\Scripts\\activate\n```\n\n2) Install dependencies\n\n```\npip install -r dbauction/requirements.txt\n```\n\n3) Configure database connection (local dev)\n\nThe project currently reads MySQL settings from `dbauction/dbauction/settings.py`.\n- For local dev, set host/user/password/name to your MySQL instance\n- For Cloud SQL (GAE), it switches based on `GAE_APPLICATION` env var\n\nRecommended: use environment variables and a `local_settings.py` override to avoid committing secrets. Example variables to define:\n- `DB_HOST`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_PORT`\n- `DJANGO_SECRET_KEY`\n\n4) Initialize database schema\n\nOption A — via Django migrations:\n```\ncd dbAuction/\npython manage.py migrate\npython manage.py createsuperuser  # optional admin\n```\n\nOption B — via provided SQL assets:\n- See `Group9_SQL_script/Phase4_submission/` (DDL, DML, Views, Triggers)\n- Create the `auction` schema, run `dbDDL.sql`, then seed with `dbDML.sql`\n\n5) Run the app\n\n```\ncd dbauction\npython manage.py runserver\n```\n\n## Setup — Streamlit NL→SQL Demo\n\n1) Install dependencies for Streamlit\n\n```\npip install -r dbauction/StreamLitApp/requirements.txt\n```\n\n2) Configure environment\n\nChoose either environment variables or Streamlit secrets.\n\n- Environment variables (.env.exmaple)\n\n- Streamlit secrets (recommended for Streamlit):\n  - Create `./.streamlit/secrets.toml` with:\n    - `OPENAI_API_KEY = \"your_key\"`\n    - Top‑level keys for Streamlit app (optional):\n      - `DB_HOST = \"your_mysql_host\"`\n      - `DB_NAME = \"auction\"`\n      - `DB_USER = \"root\"`\n      - `DB_PASSWORD = \"your_password\"`\n      - `DB_PORT = \"3306\"`\n    - And/or a block for Django fallback:\n      - `[mysql]`\n      - `host = \"your_mysql_host\"`\n      - `name = \"auction\"`\n      - `user = \"root\"`\n      - `port = \"3306\"`\n      - `password = \"your_password\"`\n    - Optionally, a Django section for secret key:\n      - `[django]`\n      - `secret_key = \"your_django_secret\"`\n\nNotes:\n- The repo `.gitignore` excludes `.streamlit/secrets.toml` and `.env*`.\n- Production uses environment variables only; `.streamlit/secrets.toml` is intended for local development.\n- Django reads DB settings from env first; if missing and `DJANGO_DEBUG=1`, it falls back to `[mysql]` in `./.streamlit/secrets.toml`. `SECRET_KEY` can be set via `DJANGO_SECRET_KEY` or `[django].secret_key` (dev only). If none and `DJANGO_DEBUG=1`, a temporary key is generated.\n- The app will warn if the key or DB credentials are not configured.\n\n## Deployment\n\n- Set environment variables: `DJANGO_SECRET_KEY`, `DB_HOST`, `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_PORT`, `DJANGO_DEBUG=0`\n- Configure `ALLOWED_HOSTS` in `settings.py` (or inject via env if you add it)\n- Apply migrations: `python manage.py migrate`\n- Collect static files: `python manage.py collectstatic --noinput`\n- Run with a production server (gunicorn/uwsgi) behind a reverse proxy\n\n3) Run Streamlit\n\n```\ncd dbauction/StreamLitApp\nstreamlit run app.py\n```\n\nNote: The current `app.py` uses a legacy OpenAI completion model and hard‑coded settings. For production/hardening, switch to environment variables and a modern model.\n\n## URLs (Django)\n\n- `/` — Home (open listings)\n- `/login`, `/logout`, `/register`\n- `/create` — New listing\n- `/listing/\u003cid\u003e` — Listing detail (bid/comment/close)\n- `/categories`, `/categories/\u003cid\u003e`\n- `/watchlist`\n\n## Screenshots\n\nScreenshots are available in `dbauction/demo/`:\n\nHome page\n![alt text](dbauction/demo/HomePage.png \"HomePage\")\nStreamlit NL→SQL\n![alt text](dbauction/demo/Stramlit.png \"GPTquery\")\n\n\n\n\n## Troubleshooting\n\n- MySQL connection errors: verify host/port/user/password and DB exists\n- Migrations failing: ensure MySQL 8 and correct permissions; try `python manage.py migrate --plan`\n- Static files: run `python manage.py collectstatic` when deploying\n- OpenAI errors: confirm `OPENAI_API_KEY` and model availability\n- Installation error for `openAI`: use the pip package name `openai` if needed\n\n## Security Notes\n\n- Do not commit secrets (DB passwords, OpenAI keys, Django `SECRET_KEY`)\n- Prefer environment variables or a non‑tracked `local_settings.py`\n\n## Roadmap\n\n- Move all secrets to environment variables (Django + Streamlit)\n- Replace legacy OpenAI completion API with up‑to‑date models\n- Add tests (unit/integration) for bidding and permissions\n- Add pagination/search, richer user profiles, seller dashboards\n- Containerize (Docker) and add CI for deploys\n\n## License\n\nlicense (MIT/Apache‑2.0, etc.).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyang10%2Fopenai-dbauctionsystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyang10%2Fopenai-dbauctionsystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyang10%2Fopenai-dbauctionsystem/lists"}