Giter VIP home page Giter VIP logo

sbbrowser's Introduction

SBTools

SBTools is a Django web service for browsing the SponsorBlock database (https://sponsor.ajay.app/).
The project is tested to work on Python 3.8.

There is a publicly hosted instance of this service at https://sb.ltn.fi/

Installation & Usage

To install the requirements on Linux, psycopg2 needs to be compiled. pip does this automatically if build requirements are available. https://www.psycopg.org/docs/install.html#build-prerequisites

An alternative to building is to use psycopg2-binary. You can edit requirements.txt or install it manually if you can't or don't want to build.
The binary version is not recommended for production by psycopg2 developers and could in certain situations lead to problems, which is why we default to building. https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary

Development

For development you can clone the repo, install requirements.txt (in a venv preferably) and run the Django development server with (venv) python manage.py runserver.

Database should still be migrated to PostgreSQL (e.g. pgloader database.db postgresql://sponsorblock@localhost/sponsorblock) and modified with INSERT INTO config VALUES ('updated', now()); or similar.
Database connection details are configured in SBtools/settings/development.py
The SECRET_KEY doesn't need changing necessarily.

Production

There are helpful files under docs/ for deploying the service.

All examples assume a Linux user sponsorblock with home folder at /srv/sponsorblock/ and proxying the site through Nginx with webroot at /srv/http/sbtools/

You should also have a PostgreSQL user sponsorblock with a database called sponsorblock.
Based on brief testing, using the SQLite database has abysmal performance.

Installing before running could look like the following

[sponsorblock]$ git clone https://github.com/Lartza/SBbrowser.git
[sponsorblock]$ python -m venv /srv/sponsorblock/SBbrowser/venv
[sponsorblock]$ /srv/sponsorblock/SBbrowser/venv/bin/pip install -r /srv/sponsorblock/SBbrowser/requirements.txt
[sponsorblock]$ /srv/sponsorblock/SBbrowser/venv/bin/pip install gunicorn
[sponsorblock]$ DB_PASSWORD='changeme' SECRET_KEY='changeme' STATIC_ROOT='/srv/http/sbtools/static/' DJANGO_SETTINGS_MODULE='SBtools.settings.production' /srv/sponsorblock/SBbrowser/venv/bin/python /srv/sponsorblock/SBbrowser/manage.py collectstatic --noinput

The DB_PASSWORD, SECRET_KEY and STATIC_ROOT variables are also present in files under docs/ and should be modified as needed.
SECRET_KEY should be a large random value and kept secret. You could generate one on https://djecrety.ir/

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

AGPLv3

sbbrowser's People

Contributors

lartza avatar ajayyy avatar choromanski avatar

Watchers

James Cloos 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.