Skip to content

joshrosenhanst/litbit

Repository files navigation

Lit Bit - Auto Generated Poems

LitBit generates a small poem from lines popular literature.

Tech

  • Python 2.7
  • Flask
  • Uwsgi

Dev Environment Setup

  1. Clone repo
  2. apt-get install python-dev python-pip
  3. pip install virtualenv
  4. virtualenv env
  5. source env/bin/activate
  6. pip install uwsgi flask hashids
  7. flask run

UWSGI and Nginx Setup (Ubuntu 16.04 / systemd service)

  1. Copy litbit.ini.example to litbit.ini and edit the paths
  2. 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
  }
}
  1. Add domain name to /etc/hosts
  2. Copy litbit.service.example to /etc/systemd/system/litbit.service and edit paths
  3. sudo systemctl enable litbit
  4. sudo service litbit restart and sudo service nginx restart
  5. Check permissions (everything should be group:www-data and 755) and the litbit/env/bin folder to make sure depencendies (flask/uwsgi) are there
  6. Error logs can be found at:
  • journal ctl -u litbit.service
  • nginx error logs
  • logs/app.log

Useful links:

Adding books

  1. Grab free use books from Project Gutenberg or similar source in plain .txt format.
  2. Remove all unnecessary text from before or after the book text (ex: table of contents, prefaces, etc). We only want the actual book text.
  3. Add the .txt file to the books/ directory
  4. Grab a cover image, as well as title, author, and year details.
  5. Run the flask register command to add new books to the books.json list

About

Lit Bit - Auto Generated Poems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •