113 lines
4.3 KiB
Markdown
113 lines
4.3 KiB
Markdown
# myriad
|
|
|
|
flask app for plurals to publicly share member lists
|
|
|
|
logged in users are presumed to all be admins with distinction only between being logged in and not
|
|
|
|
in the blog view, member privacy outweighs individual post privacy. if a private member makes a public post, it will not show up in the public feed. however, if that member switches to public, their public posts will all become publicly viewable (but private posts will remain private).
|
|
|
|
the blinkies and stamps stuff is literally just because i want an easy way to upload them when i find them. and im the dev so i get to decide mwa ha ha
|
|
|
|
make sure blinkies are actually blinkie-sized, and stamps are likewise stamp-sized. too much variation in size will make the layout weird. there's not validation because its designed just to make uploading the images not require ftp + manual code as i had been doing before.
|
|
|
|
# dev set up (windows)
|
|
|
|
- after cloning, run `py -3 -m venv .venv` in the root directory and then `.venv\Scripts\activate`
|
|
- then `pip install Flask` inside the virtual env
|
|
- you might also need to init a database, so use `flask --app myriad init-db`
|
|
- to start the site use `flask --app myriad run --debug`
|
|
|
|
do not deploy this way, the packaged flask server is not secure. production instructions will be provided when the project is ready
|
|
|
|
- you will need to run `.venv\Scripts\activate` from the folder every time you start working on it
|
|
- re-building the entire database with `flask --app myriad init-db` (losing all the data inside) will be necessary as development continues. DO NOT STORE ANYTHING IMPORTANT DURING DEVELOPMENT
|
|
- start the site with `flask --app myriad run --debug` as usual
|
|
|
|
# prod set up (linux)
|
|
|
|
it is recommended to run waitress in a tmux window for easier management
|
|
|
|
create new tmux window:
|
|
tmux new -s myriad
|
|
|
|
detach from tmux window:
|
|
ctrl+b -> d
|
|
|
|
attach to existing tmux window:
|
|
tmux attach -t myriad
|
|
|
|
git clone https://tea.cubes.link/cube/myriad.git
|
|
cd myriad
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
|
|
pip install flask
|
|
pip install waitress
|
|
|
|
mkdir instance
|
|
mkdir myriad/static/icons
|
|
mkdir myriad/static/blinkies
|
|
mkdir myriad/static/stamps
|
|
mkdir myriad/static/tmp
|
|
|
|
sudo nano instance/config.py
|
|
(copy and paste sample from readme)
|
|
|
|
python -c 'import secrets; print(secrets.token_hex())'
|
|
copy value generated above (maybe do the generation on a local machine so it easier to copy/paste)
|
|
add new line to config.py:
|
|
SECRET_KEY = '(paste generated key here)'
|
|
|
|
flask --app myriad init-db
|
|
waitress-serve --port=80 --call 'myriad:create_app'
|
|
|
|
after running and setting up first user stop waitress (CTRL+C), then `sudo nano instance/config.py` and set `REGISTRATION = False`
|
|
|
|
## updating
|
|
|
|
stop waitress (CTRL+C) and use `git pull` to pull changes
|
|
start waitress again to reload
|
|
if it is a database changing update, use backup features, re-init db, then re-import from backup
|
|
|
|
|
|
# config
|
|
|
|
- create `config.py` in the instance folder and customise the following settings to your needs
|
|
|
|
```
|
|
REGISTRATION = True # Make sure to disable in production
|
|
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'} # Can be anything you want
|
|
ICON_UPLOAD_FOLDER = 'myriad/static/icons' # where member icons will be stored
|
|
BLINKIES_UPLOAD_FOLDER = 'myriad/static/blinkies' # where site assets "blinkies" will be stored
|
|
STAMPS_UPLOAD_FOLDER = 'myriad/static/stamps' # where site assets "stamps" will be stored
|
|
THEMES_FOLDER = 'myriad/static/themes' # where theme choices will be stored
|
|
TMP_FOLDER = 'myriad/static/tmp' # folder for creating export files
|
|
```
|
|
|
|
# usage
|
|
|
|
- the software here is free to use, and there's no requirement to link back
|
|
- edit the styles and functionality to suit your needs. i'm sure some of you out there are far better with CSS than I am
|
|
|
|
# dependencies
|
|
|
|
- Flask
|
|
|
|
# preview
|
|
|
|
- these screenshots are all from the public viewer's perspective
|
|
|
|
- homepage with pinned members
|
|

|
|
|
|
- main blog post feed
|
|

|
|
|
|
- member page showing their uploaded icons (just about)
|
|

|
|
|
|
- groups view
|
|

|
|
|
|
- a sample part of the administration
|
|
 |