Giter Site home page Giter Site logo

rlalpha49 / anicards Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 6.97 MB

A dynamic Flask application that retrieves and displays user data from AniList in the form of attractive SVG stat cards. Ideal for anime enthusiasts and data visualization fans alike.

Home Page: https://anicards.alpha49.com

License: GNU General Public License v3.0

HTML 25.64% Python 47.70% JavaScript 11.43% CSS 15.23%
anilist anilist-api anilistapi anime manga statistics stats website javascript python flask-application css html

anicards's Introduction

AniCards

Route Tests CodeQL Qodana Lint Code Base

This is a Flask application that generates SVG stat cards for AniList users. It fetches user data from AniList and generates an SVG image that displays the user's statistics in a visually appealing way.

Table of Contents

Features

  • Fetches user data from AniList using the AniList GraphQL API.
  • Generates SVG stat cards that display the user's statistics.
  • Supports multiple themes for the stat cards. (Hopefully Later)
  • Stores generated SVGs in a PostgreSQL database for caching.

How it Works

The application uses Flask and SQLAlchemy to serve a web application and interact with a PostgreSQL database. When a request is made to generate SVGs for a user, the application fetches the user's data from AniList, generates an SVG image, and stores the SVG in the database. If the SVG for a user already exists in the database, the application serves the cached SVG instead of generating a new one.

Prerequisites

Before running the application, make sure you have the following installed:

Running the Application

First, clone the repository:

git clone https://github.com/RLAlpha49/Anilist-Stat-Cards.git

Next, navigate into the cloned repository:

cd Anilist-Stat-Cards

Now, create a Python virtual environment. This will help to keep the dependencies required by different projects separate by creating isolated Python environments for them:

# If Python and venv are added to your PATH, or you're on macOS or Linux:
python3 -m venv env

# If you're on Windows and Python is not added to your PATH:
py -m venv env

Activate the virtual environment:

# If you're on macOS or Linux:
source env/bin/activate

# If you're on Windows:
.\env\Scripts\activate

Then, you can install the necessary Python packages:

pip install -r requirements.txt

You can start the application by running either of the following commands:

python main.py

or

python wrapper.py

Running main.py will start the application directly.

Running wrapper.py will also start the application, but in addition, it provides control commands for the server. You can use commands like "restart", "stop", "start", "pull", and "close" to control the server's operation.

The application will be available at http://localhost:5000.

Running the Application with Waitress and Cloudflare

Waitress is a production-quality WSGI server that can be used to run your Flask application. Here's how you can run your application with Waitress and have it hosted by Cloudflare:

  1. Activate the Python virtual environment:

    # If you're on macOS or Linux:
    source env/bin/activate
    
    # If you're on Windows:
    .\env\Scripts\activate
  2. Install Waitress:

    pip install waitress
  3. Navigate to your application's directory and run Wrapper.py:

    cd path/to/your/application
    python main.py

    or

    python wrapper.py

    Replace path/to/your/application with the actual path to your application's directory.

    By default, I have waitress set to use 4 threads. If you want to change this, edit this line in 'server.py' to the amount of threads you want.

    return subprocess.Popen(['waitress-serve', '--port=5000', '--threads=4', 'main:app'], stdout=subprocess.PIPE)

    The application will now be available at http://localhost:5000.

  4. Configure Cloudflare:

    Go to your Cloudflare dashboard, add your domain, and update your DNS records to point to your server's IP address and port 5000. Make sure your SSL/TLS encryption mode is set to "Full".

Deploying to Heroku

This application is designed to be easily deployable to Heroku. It uses the DATABASE_URL environment variable to configure the database, and automatically converts postgres:// URLs to postgresql:// URLs, which are required by SQLAlchemy.

To deploy the application to Heroku, you can use the Heroku CLI:

heroku create
git push heroku master
heroku open

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Credits

The default designs of the SVGs are based on the github-profile-readme-maker repository, which is licensed under the GPL-3.0 License.

Disclaimer

This project is not affiliated with AniList in any way. It is a standalone project that uses the AniList GraphQL API to fetch user data and generate SVG stat cards.

anicards's People

Contributors

rlalpha49 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

anicards's Issues

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.