Code Monkey home page Code Monkey logo

awesome-deck's Introduction

Hearthstone Deck Embed Tool

A simple Hearthstone card deck API that you can easily embed in your site with iframe. The backend of Awesome Deck.

Work with Python3, Django, and MySQL/MariaDB.

How to Use

Requirements

Install pip for Python3:

apt install python3-pip

Install required packages:

pip install -r requirements.txt

If you see something like:

EnvironmentError: mysql_config not found

You should install libmysqlclient-dev:

sudo apt install default-libmysqlclient-dev

Configuration

Rename the configuration file conf.sample.ini as conf.ini, and fill in your info.

Initialize Database

Cards data from HearthstoneJSON, this script will get the latest Json data automatically.

Initialize the Database with:

python db_initial.py
Auto Start Configuration

Latter if you need a cards data auto update (who knows when Bilzzard will release a hotfix and diminish some cards), there's a database auto update script auto_update.py, add it to system autostart tasks, and then for every 6 hours (you may change it to any interval by modifying the scrpit).

On a Ubuntu 18+, you may do so:

Create unit file in /lib/systemd/system/hearthstone_deck_auto_update.service with the following content:

[Unit]
Description=<hearthstone_deck_auto_update>
After=network.target network-online.target

[Service]
Type=simple
User=<required_user_name>
Group=<required_group_name>
Restart=always
ExecStartPre=/bin/mkdir -p /var/run/hearthstone_deck_auto_update
PIDFile=/var/run/hearthstone_deck_auto_update/service.pid
ExecStart=/path/to/your/auto_update.py

[Install]
WantedBy=multi-user.target

Save this file and reload systemd:

sudo systemctl daemon-reload

Then add your service to autostart:

sudo systemctl enable hearthstone_deck_auto_update.service

you should see that Systemd created required symlinks after enable action.

Reboot and see if it's up and running (ps aux | grep python or sudo systemctl status hearthstone_deck_auto_update.service). If there is something weird - check Systemd journal:

sudo journalctl -xe

Run web service

Then you can run the test server:

python web/manage.py runserver 0.0.0.0:8000

Or run with uwsgi:

cd web/web
uwsgi --http :8000 --module web.wsgi

Then visit: http://127.0.0.1:8000/.

Author

© Mashiro, Released under the MIT License.

awesome-deck's People

Contributors

mashirozx avatar pyup-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.