|
||
---|---|---|
avatars | ||
static | ||
templates | ||
LICENSE | ||
README.md | ||
myshed.py | ||
salt.py | ||
toolshed.py |
README.md
MyShed
MyShed is a marriage of YCombinator's HackerNews site and Facebook written in Python.
Setup
Download the source code:
$ git clone https://git.catvibers.me/videotoaster/myshed.git
$ cd myshed
Create the SQLite3 database:
$ sqlite3 MyShed.db
sqlite> CREATE TABLE users(name, password, bio, credate, friends, avatar, ismod)
sqlite> CREATE TABLE friendships(friend1, friend2, accepted)
sqlite> CREATE TABLE posts(poster, date, replyto, subject, content, id)
sqlite> .quit
Create user accounts for you and your friends:
$ python3
>>> import toolshed
>>> toolshed.createuser("Username", "Password", True) # True if mod, False if not
>>> exit()
Now you can start MyShed like this:
$ python3 myshed.py
The only problem is that it strictly runs on 127.0.0.1, port 1090. You will need to set up Apache 2 to reverse proxy it to the internet. Of course, you can use Nginx for this too, if you know what you're doing, but this is how I did it on Debian.
$ sudo apt install apache2
$ sudo a2enmod proxy
$ sudo (editor) /etc/apache2/sites-enabled/000-default.conf
You should make the file look like this:
<VirtualHost *:80>
ServerName [domain name you want myshed to run on]
ServerAdmin webmaster@localhost
ProxyPass / http://127.0.0.1:1090/
ProxyPassReverse / http://127.0.0.1:1090/
ErrorDocument 503 "<pre>MyShed is unavailable at this time.</pre>"
ErrorLog ${APACHE_LOG_DIR}/shed-error.log
CustomLog ${APACHE_LOG_DIR}/shed-access.log combined
</VirtualHost>
After this, restart Apache 2:
$ sudo systemctl restart apache2
and you should be able to log into your MyShed account on the domain you specified in your Apache 2 configuration file.