aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-02-13 22:11:38 -0500
committerB. Stack <bgstack15@gmail.com>2022-02-13 22:11:38 -0500
commit39eb97cbceeb332c21eaeeb4843b58b34667cfb2 (patch)
treeeb11eee877bc42163ce3e17c8fcd99cf72eb1d69
parentadd expiry, and wsgi usage to support that (diff)
downloadstackbin-39eb97cbceeb332c21eaeeb4843b58b34667cfb2.tar.gz
stackbin-39eb97cbceeb332c21eaeeb4843b58b34667cfb2.tar.bz2
stackbin-39eb97cbceeb332c21eaeeb4843b58b34667cfb2.zip
refactor filenames and improve docs
-rw-r--r--README-bgstack15.md51
-rw-r--r--README.md58
-rw-r--r--config.cfg.example (renamed from config.cfg.tpl)0
-rw-r--r--initdb.py2
-rw-r--r--manage.py2
-rwxr-xr-xstackbin.bin1
-rwxr-xr-xstackbin.py (renamed from pastebin.py)3
-rw-r--r--stackbin.wsgi.ini5
8 files changed, 58 insertions, 64 deletions
diff --git a/README-bgstack15.md b/README-bgstack15.md
deleted file mode 100644
index 67b143e..0000000
--- a/README-bgstack15.md
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
- -- Filename: README-bgstack15.md
- -- Startdate: 2022-02-11
- --
- -->
-# Overview
-This is my proposed solution to my pastebin problem.
-
-# Features
-
-* Admin page which can list parents, children, and provide link to delete pastes.
-* Editable titles
-* "Reply to" pastes to make parent/children relationships
-* UUIDs instead of sequential integer ID numbers
-* Private pastes (accessible to admin, and to users with the whole link)
-
-# Instructions
-
-Generate new db.
-
- python3 initdb.py
-
-Run server in development mode.
-
- FLASK_APP=pastebin.py FLASK_DEBUG=True flask run --host='0.0.0.0'
-
-Run the server in a full wsgi environment for the cleanup timer to operate.
-
- ./stackbin.bin
-
-# Improvements
-I still need to work on these tasks:
-
-## Development
-
-* Protect the /admin/ page
-
-## Release
-
-* Document centos7 dependencies
-* Deploy to prod
-
-# Alternatives
-
-## Unresearched
-https://github.com/yasoob/logit-bin
-https://github.com/AWilliams17/PasteMate
-https://github.com/bsamadi/flask-pastebin
-
-## Attempted
-https://github.com/Tygs/0bin sounds cool but it uses a stack I'm unfamiliar with and it had some issues and I didn't want to bother with it.
diff --git a/README.md b/README.md
index f1bdbab..be7d7eb 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,53 @@
-### Flask-Pastebin
+<!--
+ -- Filename: README.md
+ -- Startdate: 2022-02-11
+ -->
+# Overview
+This is my proposed solution to my pastebin problem.
-This is a fork of [mitsuhiko/pastebin](https://github.com/mitsuhiko/flask-pastebin)
+# Features
-#### How to use
+* Admin page which can list parents, children, and provide link to delete pastes.
+* Editable titles
+* "Reply to" pastes to make parent/children relationships
+* UUIDs instead of sequential integer ID numbers
+* Private pastes (accessible to admin, and to users with the whole link)
- 1. make a virtualenv
- 2. `pip install -r requirements.txt`
- 3. `cp config.cfg.tpl config.cfg`
- 4. `python manage.py initdb`
- 5. `python manage.py server`
+# Instructions
+
+Configure the application with `config.cfg` based on `config.cfg.example`.
+
+Generate new db.
+
+ python3 initdb.py
+
+Run server in development mode.
+
+ FLASK_APP=stackbin.py FLASK_DEBUG=True flask run --host='0.0.0.0'
+
+Run the server in a full wsgi environment for the cleanup timer to operate.
+
+ ./stackbin.bin
+
+# Improvements
+I still need to work on these tasks:
+
+## Development
+
+* Protect the /admin/ page
+
+## Release
+
+* Document centos7 dependencies
+* Deploy to prod
+
+# Alternatives
+This is a very diverged fork of [su27/flask-pastebin](https://github.com/su27/flask-pastebin) which itself was a fork of the original [mitsuhiko/pastebin](https://github.com/mitsuhiko/flask-pastebin). The original had a few additional features worth reviewing.
+
+## Unresearched
+https://github.com/yasoob/logit-bin
+https://github.com/AWilliams17/PasteMate
+https://github.com/bsamadi/flask-pastebin
+
+## Attempted
+https://github.com/Tygs/0bin sounds cool but it uses a stack I'm unfamiliar with and it had some issues and I didn't want to bother with it.
diff --git a/config.cfg.tpl b/config.cfg.example
index 23fb072..23fb072 100644
--- a/config.cfg.tpl
+++ b/config.cfg.example
diff --git a/initdb.py b/initdb.py
index da4f05a..ba25591 100644
--- a/initdb.py
+++ b/initdb.py
@@ -1,3 +1,3 @@
-from pastebin import db
+from stackbin import db
no_wsgi = True
db.create_all()
diff --git a/manage.py b/manage.py
index c19b039..ce535fd 100644
--- a/manage.py
+++ b/manage.py
@@ -1,6 +1,6 @@
from flask_script import Manager, Server
from flask_script.commands import Clean
-from pastebin import app, db
+from stackbin import app, db
manager = Manager(app)
diff --git a/stackbin.bin b/stackbin.bin
index d3b2da3..4fb3241 100755
--- a/stackbin.bin
+++ b/stackbin.bin
@@ -1,7 +1,6 @@
#!/bin/sh
# Reference: fuss.bin from fuss project
# Startdate: 2022-02-13 19:25
-# Goal: see if uwsgi reacts to the @timer directives in the pastebin.py file, because flask run doesn't.
thisscript="$( readlink -f "${0}" )"
COMMAND=""
grep -qiE 'ID=.*(rhel|centos|fedora)' /etc/os-release && COMMAND="${COMMAND} uwsgi" || \
diff --git a/pastebin.py b/stackbin.py
index d06dc6e..aac3f49 100755
--- a/pastebin.py
+++ b/stackbin.py
@@ -1,3 +1,6 @@
+# File: stackbin.py
+# SPDX-License-Identifier: GPL-3.0
+# Authors: mitsuhiko, su27, bgstack15
from datetime import datetime, timedelta
from itsdangerous import Signer
from flask import (Flask, request, url_for, redirect, g, render_template, session, abort)
diff --git a/stackbin.wsgi.ini b/stackbin.wsgi.ini
index cac4511..4b38ea8 100644
--- a/stackbin.wsgi.ini
+++ b/stackbin.wsgi.ini
@@ -1,11 +1,12 @@
[uwsgi]
plugins = logfile
http-socket = 0.0.0.0:5000
-wsgi-file = pastebin.py
+wsgi-file = stackbin.py
callable = app
-touch-reload = pastebin.py
+touch-reload = stackbin.py
touch-reload = config.cfg
touch-reload = stackbin.wsgi.ini
+# the template files are not necessary, because flask always loads it from disk for each request
req-logger = file:log/req.log
# to get strftime format fields, you need double percent signs
logdate = "%%FT%%T"
bgstack15