Skip to content
jerryyou04Public

About

Compare PC components, track used-market prices, and plan your next build. • Django

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

Visit the live site: pctracker.ca

PCTracker — development snapshots

PCTracker is up and running at pctracker.ca. You can browse PC components, compare benchmarks and used-market prices, plan builds, and check eBay listings.

Live hosting

I run PCTracker on a Hetzner VPS. Nginx handles the public web traffic and static files, while Gunicorn runs the Django application behind it:

Browser → Nginx → Gunicorn → Django → database

The frontend uses Django templates, HTML, CSS, and JavaScript. The application stores its catalog and account/build data in a database, and its eBay integration uses server-side API credentials to fetch listing prices.

What this repository is for

I use this repository to keep selected snapshots of PCTracker's source code and development history. The live site keeps evolving, so a snapshot may be older than what is currently deployed, contain unfinished work, or need configuration changes before it runs in another environment.

This is a snapshot archive rather than a packaged release with a maintained installer. I share it so you can explore the code and adapt it for your own use. Private runtime settings, databases, logs, and credentials are excluded. Commit dates are preserved, but the sanitized history has different commit hashes from the original private snapshots.

Running your own instance

You can configure a snapshot as your own Django instance and connect your own database. The outline below explains the pieces involved; it is not a promise that every historical snapshot will run unchanged.

Dependencies and settings

Use a Python virtual environment and install the Python dependencies from requirements.txt. Those pins record the snapshot's environment; review and update them for your own deployment. The live site may use newer versions.

Copy myproject/myproject/settings.py.example to myproject/myproject/settings.py and adapt it for your environment:

  • Set your own DJANGO_SECRET_KEY in the process environment. The snapshot does not automatically load .env files.
  • Replace the /var/www/pctracker/ paths in STATICFILES_DIRS, STATIC_ROOT, and LOGGING with paths on your machine. A console logging configuration is another option for local development.
  • For local HTTP development, use DEBUG = True, allow localhost and 127.0.0.1 in ALLOWED_HOSTS, and set SECURE_SSL_REDIRECT, SESSION_COOKIE_SECURE, and CSRF_COOKIE_SECURE to False in your local settings. Keep the production HTTPS settings for a public deployment.
  • Use your own email configuration and EMAIL_HOST_PASSWORD, or replace the example's SMTP settings block with Django's console email backend for local development.
  • Set your own EBAY_CLIENT_ID and EBAY_CLIENT_SECRET if you want to fetch eBay listing prices. They are not needed just to start the application.

Your database

The settings example uses SQLite, with a local myproject/db.sqlite3 file. You can keep that for your own instance, or edit Django's DATABASES setting to use your own database server. For example, with PostgreSQL and the appropriate Python driver installed:

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": os.environ["DB_NAME"],
        "USER": os.environ["DB_USER"],
        "PASSWORD": os.environ["DB_PASSWORD"],
        "HOST": os.environ.get("DB_HOST", "127.0.0.1"),
        "PORT": os.environ.get("DB_PORT", "5432"),
    }
}

Create that database and user yourself, then supply their connection values in your environment. See Django's database documentation for backend and driver requirements. Your instance has its own catalog, accounts, and builds; it does not connect to the live PCTracker database.

Starting Django

After installing dependencies and configuring your settings and database, run these commands from the repository root:

python myproject/manage.py check
python myproject/manage.py migrate
python myproject/manage.py runserver 127.0.0.1:8000

Open http://127.0.0.1:8000. The entry point is myproject/manage.py; if you first change into the myproject directory, the equivalent command is python manage.py runserver.

To load the included catalog CSVs into your own database, you can also run this from the repository root:

python myproject/manage.py seed_parts --dir data

Django's runserver is for development. For a public instance, configure your own production hosting, such as the Nginx and Gunicorn setup I use for the live site.

About

Compare PC components, track used-market prices, and plan your next build. • Django

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages