Migrated from Forgejo: mattc-old/yikchan
- Python 59%
- CSS 24.8%
- HTML 13.5%
- Makefile 2.5%
- JavaScript 0.2%
| static | ||
| templates | ||
| .gitignore | ||
| app.py | ||
| config.py | ||
| default.config | ||
| forbidden.txt | ||
| fortune.py | ||
| Makefile | ||
| postlib.py | ||
| profanity_wordlist.txt | ||
| README.md | ||
| requirements.txt | ||
| sed.py | ||
| yikchan.service | ||
yikchan
bucknell.wtf sourcecode
deployment
- edit
default.config, or make a new file, with the same format, suiting your needs.- if you make a new file, you'll need to add it to the arguements when running
app.py. Example:python3 app.py my_custom.config app.pyassumes you'd like to usedefault.configotherwise.
- if you make a new file, you'll need to add it to the arguements when running
- check the big ol' block at the top of
app.pyto make sure it suits your needs- if you use the
yikchan.service, the port is always8000
- if you use the
- check and tweak any of the files under
staticandtemplatesas desired- In HTML templates,
{{variables}}are used to insert data from Python code. You can of course edit the surrounding tags, but the underlying data comes from the Flask app. (which is very simple, so you could of course tweak it too.)
- In HTML templates,
- check and tweak
forbidden.txtas desired. Each line is a word or phrase that, if included in a post, will prevent it being posted. (Primitive spam prevention measure.) - run
python3 app.py(or gunicorn w/ some proxy if you're doing production. i'm not your mom, i won't judge)- You could use
make deployto automate above and also copy the exampleyikchan.serviceautomatically.
- You could use
sources
- https://stackoverflow.com/a/925630 - for stripping HTML
- https://stackoverflow.com/questions/25674322/post-values-from-an-html-form-and-access-them-in-a-flask-view - multiple answers combined to fix my flask endpoint
- https://stackoverflow.com/a/10965916 - flask aliases
- https://www.edmondchuc.com/deploying-python-flask-with-gunicorn-nginx-and-systemd/ - flask deployment
- https://stackoverflow.com/questions/905144/sed-beginner-changing-all-occurrences-in-a-folder - to fix timestamps w/o editing my code
CSS
(With some modifications, that can be seen in the static dir)