PDHdata / SmallFormats

Deck-stats server for less-common Magic: the Gathering formats
MIT License
6 stars 0 forks source link

SmallFormats

Inspired by EDHrec, this is a deck-stats tool for Pauper EDH and hopefully other "smaller" (less common) Magic: the Gathering formats someday. It was built to power PDHdata, which is a deck-stats site specifically for PDH.

Running your own

Naming

This software is offered to you under the MIT license. That means you may use some or all of it to run your own project. However, you don't have the right to the name SmallFormats or PDHdata. You'll need to set an environment variable SMALLFORMATS_NAME or edit the config in smallformats/settings.py to whatever you're choosing to call your project.

Database setup

Unlike many Django projects, this one doesn't use SQLite locally. We depend on several Postgres-specific features (materialized views, JSON field features, etc.). While we love SQLite, it was becoming burdensome to support dev-only hacks mirroring Postgres features. So as of now, we only support Postgres. At time of writing (2023-02-26), we're using Postgres 14 in production.

For local dev work on my Mac, I've found Postgres.app to work well. You can either create a database called pdhdev or pass a DATABASE_URL with appropriate details every time you call ./manage.

Initial setup

It's a Django project managed with Poetry. For local dev, it's mostly the usual cycle of commands (though I've added a ./manage shell script so you can avoid typing poetry run ./manage.py all the time).

poetry install
./manage migrate
./manage createsuperuser
./manage runserver

Fetching data

You will need card data from Scryfall and then a two-pass crawl of Archidekt. The crawl step will fetch each deck, and then the populate step will fetch the decklists for each deck.

./manage fetch-cards
./manage crawl-archidekt
./manage populate-archidekt --crawl-id $ID_FROM_PREVIOUS_STEP

Deploying to production

That part is up to you!

Disclaimers & disclosures

SmallFormats is unofficial Fan Content permitted under WOTC's Fan Content Policy. Not approved/endorsed by Wizards. Portions of the materials used are property of Wizards of the Coast. ©Wizards of the Coast LLC.

Scryfall has not endorsed this app or its creators. You should not have paid anything to anyone for its use. You may not use Scryfall data to create new games, or to imply the information and images are from any other game besides Magic: The Gathering.

Archidekt has not endorsed this app or its creators.

Thanks to Davis Haupt for the fly.io deployment article which informed the layout of this project.