LitBit generates a small poem from lines popular literature.
- Python 2.7
- Flask
- Uwsgi
- Clone repo
apt-get install python-dev python-pip
pip install virtualenv
virtualenv env
source env/bin/activate
pip install uwsgi flask hashids
flask run
- Copy
litbit.ini.example
tolitbit.ini
and edit the paths - Create nginx site conf:
server {
listen 80;
server_name litbit.test;
location / {
include uwsgi_params;
uwsgi_pass unix:///var/www/litbit/app.sock
# replace above sock with your app sock file path, must have leading unix:// before path
}
}
- Add domain name to
/etc/hosts
- Copy
litbit.service.example
to/etc/systemd/system/litbit.service
and edit paths sudo systemctl enable litbit
sudo service litbit restart
andsudo service nginx restart
- Check permissions (everything should be group:www-data and 755) and the litbit/env/bin folder to make sure depencendies (flask/uwsgi) are there
- Error logs can be found at:
journal ctl -u litbit.service
- nginx error logs
logs/app.log
- https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
- https://code.luasoftware.com/tutorials/nginx/setup-nginx-and-uwsgi-for-flask-on-ubuntu/
- Grab free use books from Project Gutenberg or similar source in plain .txt format.
- Remove all unnecessary text from before or after the book text (ex: table of contents, prefaces, etc). We only want the actual book text.
- Add the .txt file to the books/ directory
- Grab a cover image, as well as title, author, and year details.
- Run the
flask register
command to add new books to the books.json list