Skip to content

HeckGuide website repo, written in django. Backend connects to the kingdoms of heckfire api via a supplied token and will crawl allies & each world's map and store results in a postgres database

License

Notifications You must be signed in to change notification settings

nrathaus/HeckGuide

 
 

Repository files navigation

HeckGuide

  1. Install Python

  2. Install Postgres

  3. Create and enter new working directory eg "HeckGuide"

  4. Create Virtual Environment

py -m venv env

Activate Environment

Mac/Unix

source env/bin/activate

Windows

.\env\Scripts\activate
  1. Install requirements for local development
pip install -r requirements/local.txt
  1. Fill in heckguide/sample.env and rename to heckguide/.env

  2. Make migrations and then run migrations

python manage.py makemigrations
python manage.py migrate
  1. Create a superuser
python manage.py createsuperuser
  1. Generate an API token for the newly created superuser (the one from step 8)
python manage.py drf_create_token superusername

Make note of the token

  1. Run server
python manage.py runserver
  1. Open website
http://127.0.0.1:8000/
  1. Development website
https://v2.heckguide.com/

Commands

For a list of commands, run:

python manage.py

Command Examples

  1. Scrapes a set number of allies '5000' already in the database without fully populated info and fills them, then scrapes the owner and that owner etc. Depth set to '3'
python manage.py crawl_allies_by_name 5000 3
  1. Scrapes allys by price '500000' and set number of pages '1', a random token will be picked to scrape.
python manage.py find_allies_by_price 500000 1
  1. Scrapes allys by random price and random number of pages
python manage.py find_random_price_allies
  1. Purchase an ally via supplied username with token
python manage.py buy_ally_by_name kevz 23
  1. Volley an ally between tokens
python manage.py volley kevz
  1. Strip a users allies, token must be given
python manage.py strip_allies kevz 23
  1. Scrape the realm starting at the lower boundry of the map, loading 20 chunks and stepping through to the upper end, pick which realm to crawl passing the token argument
python manage.py crawl_world 1
  1. Scrape the realms chat history
python manage.py poll_map 1

Troubleshooting

  1. If you encounter this error:
fatal error: libpq-fe.h: No such file or directory

Install libpq library, on Debian:

apt install libpq-dev
  1. Missing PosgresSQL:

Install:

sudo apt install postgresql postgresql-contrib

Make sure it works:

sudo -u postgres psql -c "SELECT version();"

Output should be something like:

 PostgreSQL 14.5 (Ubuntu 14.5-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, 64-bit

Create User (heckguide) and DB (heckguide):

sudo su - postgres -c "CREATEUSER heckguide"
sudo su - postgres -c "CREATEDB heckguide"

Give heckguide user access:

sudo -u postgres psql
GRANT ALL PRIVILEGES ON DATABASE heckguide TO heckguide;
ALTER USER heckguide WITH PASSWORD 'heckguide';

Change .env to this URL:

DATABASE_URL="postgres://heckguide:heckguide@127.0.0.1:5432/heckguide"

About

HeckGuide website repo, written in django. Backend connects to the kingdoms of heckfire api via a supplied token and will crawl allies & each world's map and store results in a postgres database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 55.9%
  • HTML 33.4%
  • CSS 8.7%
  • JavaScript 1.9%
  • Shell 0.1%