Home

Awesome

NyaaV2 Build Status

Setting up for development

This project uses Python 3.7. There are features used that do not exist in 3.6, so make sure to use Python 3.7. This guide also assumes you 1) are using Linux and 2) are somewhat capable with the commandline.
It's not impossible to run Nyaa on Windows, but this guide doesn't focus on that.

Code Quality:

Running Tests

The tests folder contains tests for the the nyaa module and the webserver. To run the tests:

Setting up Pyenv

pyenv eases the use of different Python versions, and as not all Linux distros offer 3.7 packages, it's right up our alley.

Setting up MySQL/MariaDB database

You may use SQLite but the current support for it in this project is outdated and rather unsupported.

Finishing up

You're now ready for simple testing and development!
Continue below to learn about database migrations and enabling the advanced search engine, Elasticsearch.

Database migrations

Setting up and enabling Elasticsearch

Installing Elasticsearch

Enabling MySQL Binlogging

Setting up ES

Enable the USE_ELASTIC_SEARCH flag in config.py and (re)start the application.
Elasticsearch should now be functional! The ES indices won't be updated "live" with the current setup, continue below for instructions on how to hook Elasticsearch up to MySQL binlog.

However, take note that binglog is not necessary for simple ES testing and development; you can simply run import_to_es.py from time to time to reindex all the torrents.

Setting up sync_es.py

sync_es.py keeps the Elasticsearch indices updated by reading the binlog and pushing the changes to the ES indices.

You're done! The script should now be feeding updates from the database to Elasticsearch.
Take note, however, that the specified ES index refresh interval is 30 seconds, which may feel like a long time on local development. Feel free to adjust it or poke Elasticsearch yourself!