diff --git a/.gitignore b/.gitignore index 30084ba..541ca10 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +__pycache__ cache/template/* -*.production -css/*.css \ No newline at end of file +venv diff --git a/README.md b/README.md index 28b32c2..82f84bd 100755 --- a/README.md +++ b/README.md @@ -1,23 +1,43 @@ # FreePost -This is the code powering [freepost](http://freepo.st). FreePost is a web-based discussion board that allows users to post text and links which other users may read and comment on (start a discussion). It also supports upvoting and downvoting of posts and has some nifty features to display the so-called **Hot** posts (those that are very popular and have been upvoted a lot) as well as the newest posts, aptly named **New**. Each user has a profile page which includes some information on themselves. +This is the code powering [freepost](http://freepo.st). FreePost is a web-based +discussion board that allows users to post text and links which other users may +read and comment on (start a discussion). It also supports upvoting and downvoting +of posts and has some nifty features to display the so-called **Hot** posts (those +that are very popular and have been upvoted a lot) as well as the newest posts, +aptly named **New**. Each user has a profile page which includes some information +on themselves. ## Development -### Stylesheets +### Setup Python3 virtual environment + + mkdir venv + virtualenv -p python3 venv + -> alternative: python3 -m venv venv + source ./venv/bin/activate + pip3 install --no-binary :all: -r requirements.txt + +### Run -Sources are in `css/`. They are compiled using Stylus. Run this command from the project's root: + source ./venv/bin/activate + python3 -m bottle --debug --reload --bind 127.0.0.1:8000 freepost -`$ stylus --watch --compress --disable-cache --out css/ css/` -### Dev server +### Stylesheets + +Sources are in `css/`. They are compiled using Stylus. Run this command from +the project's root: -Copy files to Apache `www`. + stylus --watch --compress --disable-cache --out css/ css/ ## Contacts -If you have any questions please get in contact with us at [freepost](http://freepo.st). +If you have any questions please get in contact with us at +[freepost](http://freepo.st). ## License -freepost is [free software](https://www.gnu.org/philosophy/free-sw.html) licensed as GNU Affero General Public License, either version 3 or (at your option) any later version. +freepost is [free software](https://www.gnu.org/philosophy/free-sw.html) licensed +as GNU Affero General Public License, either version 3 or (at your option) any +later version. diff --git a/freepost/__init__.py b/freepost/__init__.py new file mode 100644 index 0000000..e1e5e22 --- /dev/null +++ b/freepost/__init__.py @@ -0,0 +1,22 @@ +import bottle +import configparser +import functools +import importlib +import json +from bottle import abort, get, post, redirect, request +from urllib.parse import urlparse + +# This is used to export the bottle object for the WSGI server +# See passenger_wsgi.py +application = bottle.app () + +# Load settings for this app +application.config.load_config ('settings.ini') + +# Default app templates +bottle.TEMPLATE_PATH = [ './freepost/templates' ] + + +@get ('/', name='index') +def index (): + return "ll" diff --git a/passenger_wsgi.py b/passenger_wsgi.py new file mode 100644 index 0000000..fd7ef2a --- /dev/null +++ b/passenger_wsgi.py @@ -0,0 +1,4 @@ +# This file is for the Passenger web server. + +# We must export a WSGI object called "application" +from freepost import application diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..91e0401 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +bottle == 0.12.* +pyld == 1.* +PyMySQL == 0.9.* +requests == 2.* diff --git a/settings.ini b/settings.ini new file mode 100644 index 0000000..1451b85 --- /dev/null +++ b/settings.ini @@ -0,0 +1,4 @@ +# This is a bunch of settings useful for the app + +[name] +key = value