From 02207c762072f8ca530c76c8116ccf5a29765a92 Mon Sep 17 00:00:00 2001 From: John Washam Date: Tue, 5 Jul 2016 12:42:27 -0700 Subject: [PATCH] Finished README. --- README.md | 48 +++++++++++++++++++++++++++------------------ flash_cards.service | 14 +++++++++++++ 2 files changed, 43 insertions(+), 19 deletions(-) create mode 100644 flash_cards.service diff --git a/README.md b/README.md index 8b4a898f..35754a41 100644 --- a/README.md +++ b/README.md @@ -20,25 +20,35 @@ Will be able to use it on: It uses: - Python 3 - Flask -- other things I need to figure out +- SQLite --- -To Do: - -- [x] Log in - - [x] Auth - - [x] Auth errors - - [x] Session set - - [x] Logout -- [x] Card Area - - [x] List cards - - [x] Add cards - - [x] Edit card - - [x] Delete card -- Card Memorization - - [x] Card type toggle - - [x] Flip card - - [x] Mark as known, next card - - [x] Next card - - [x] Card filters +## How to run it + +1. Clone project to a directory on your web server. +1. Edit the config.txt file. The username and password will be the login + for your site. There is only one user - you. +1. Follow this long tutorial to get Flask running. It was way more work than it should be: + https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04 + - `wsgy.py` is the entry point. It calls `flash_cards.py` + - This is my systemd file `/etc/systemd/system/flash_cards.service`: [view](flash_cards.service) + - when done with tutorial: + ``` + sudo systemctl restart flash_cards + sudo systemctl daemon-reload + ``` +1. When you see a login page, you're good to go. +1. Uncomment the commented block in `flash_cards.py` +1. Restart Flask. You have to use `sudo systemctl restart flash_cards`. +1. Hit the URL /initdb on your web server. You'll see a message that the + database has been initialized. +1. Comment that code again. +1. Restart Flask. +1. Go to / on your webserver. +1. Log in. +1. Click the "General" or "Code" button and make a card! +1. When you're ready to start memorizing, click either "General" or "Code" + in the top menu. + +*Happy learning!* \ No newline at end of file diff --git a/flash_cards.service b/flash_cards.service new file mode 100644 index 00000000..55ddf8a5 --- /dev/null +++ b/flash_cards.service @@ -0,0 +1,14 @@ +[Unit] +Description=uWSGI instance to serve flash_cards +After=network.target + +[Service] +User=john +Group=www-data +WorkingDirectory=/var/www/cs_flash_cards +Environment="PATH=/var/www/cs_flash_cards/py3env/bin" +Environment="CARDS_SETTINGS=/var/www/cs_flash_cards/config-personal.txt" +ExecStart=/var/www/cs_flash_cards/py3env/bin/uwsgi --ini flash_cards.ini + +[Install] +WantedBy=multi-user.target \ No newline at end of file