diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..20a63bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Don't check in site specific settings. +config.py +site/www/*.html +site/www/*/* + +# Compiled Python +*.pyc diff --git a/config-sample.py b/config-sample.py new file mode 100644 index 0000000..18db3f0 --- /dev/null +++ b/config-sample.py @@ -0,0 +1,30 @@ +# Sample config file for Rophako. +# +# Edit this file and save the copy as "config.py". + +import os +_basedir = os.path.abspath(os.path.dirname(__file__)) + +DEBUG = True + +# Unique name of your site, e.g. "kirsle.net" +SITE_NAME = "example.com" + +# Secret key used for session cookie signing. Make this long and hard to guess. +# +# Tips for creating a strong secret key: +# $ python +# >>> import os +# >>> os.urandom(24) +# '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O") +def catchall(path): + """The catch-all path handler. If it exists in the www folders, it's sent, + otherwise we give the 404 error page.""" + + # Search for this file. + for root in ["site/www", "rophako/www"]: + abspath = os.path.abspath("{}/{}".format(root, path)) + print abspath + print abspath + ".html" + if os.path.isfile(abspath): + return send_file(abspath) + elif not "." in path and os.path.isfile(abspath + ".html"): + return render_template(path + ".html") + + return not_found("404") + + +@app.route("/") +def index(): + print "INDEX PAGE" + return catchall("index") + + +@app.errorhandler(404) +def not_found(error): + print "NOT FOUND" + return render_template('errors/404.html', **g.info), 404 + +# Domain specific endpoints. +if config.SITE_NAME == "kirsle.net": + import rophako.modules.kirsle_legacy \ No newline at end of file diff --git a/rophako/modules/__init__.py b/rophako/modules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rophako/modules/account.py b/rophako/modules/account.py new file mode 100644 index 0000000..722b10e --- /dev/null +++ b/rophako/modules/account.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +from flask import Blueprint + +mod = Blueprint("account", __name__, url_prefix="/account") + +@mod.route("/") +def index(): + return "Test" \ No newline at end of file diff --git a/rophako/modules/kirsle_legacy.py b/rophako/modules/kirsle_legacy.py new file mode 100644 index 0000000..ee57a16 --- /dev/null +++ b/rophako/modules/kirsle_legacy.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# Legacy endpoint compatibility from kirsle.net. + +from flask import request, redirect +from rophako import app + +@app.route("/+") +def google_plus(): + return redirect("https://plus.google.com/+NoahPetherbridge/posts") + +@app.route("/blog.html") +def legacy_blog(): + post_id = request.args.get("id", "") + + # All of this is TO-DO. + # friendly_id = get friendly ID + # return redirect(...) + return "TO-DO" + +@app.route("/.html") +def legacy_url(page): + return "/{}".format(page) \ No newline at end of file diff --git a/rophako/www/css/style.css b/rophako/www/css/style.css new file mode 100644 index 0000000..54f8fab --- /dev/null +++ b/rophako/www/css/style.css @@ -0,0 +1,88 @@ +/****************************************************************************** + * "Resets" - styles on HTML tags * + ******************************************************************************/ + +body { + background-color: #FFFFFF; + font-family: "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif; + font-size: small; + color: #000000; + width: 850px; + margin: 20px auto; +} + +h1, h2, h3, h4 { + font-family: Verdana,Arial,Helvetica,sans-serif; + font-weight: bold; + margin: 12px 0px; +} +h1 { + font-size: 32pt; + margin-top: 0px; +} +h2 { + font-size: 28pt; +} +h3 { + font-size: 24pt; +} +h4 { + font-size: 18pt; +} + +a:link, a:visited { + color: #006699; + text-decoration: underline; +} + +header { + display: block; + padding: 12px; + border: 1px solid #000000; + margin-bottom: 40px; + box-shadow: 1px 1px 5px #000000; + border-radius: 12px; +} +header h1 { + font-size: 46pt; + text-align: center; + color: #0099FF; + text-shadow: 2px 2px 2px #000099; +} + +nav { + float: left; + width: 200px; + border: 1px solid #000000; + border-radius: 12px; +} +nav ul { + list-style-type: none; + padding: 8px; + margin: 0px; +} +nav ul li { + padding: 2px 0px; +} +nav ul li.header { + font-weight: bold; +} + +div#content { + float: right; + width: 620px; +} + +div.clear { + clear: both; +} + +footer { + clear: both; + margin-top: 40px; + padding: 12px; + text-align: center; + color: #707070; + border: 1px solid #000000; + border-radius: 12px; +} \ No newline at end of file diff --git a/rophako/www/errors/404.html b/rophako/www/errors/404.html new file mode 100644 index 0000000..1259453 --- /dev/null +++ b/rophako/www/errors/404.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% block title %}Page Not Found{% endblock %} +{% block content %} + +

Page Not Found

+ +The page you requested could not be found. + +{% endblock %} \ No newline at end of file diff --git a/rophako/www/index.html b/rophako/www/index.html new file mode 100644 index 0000000..b4b48c0 --- /dev/null +++ b/rophako/www/index.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% block title %}Rophako CMS{% endblock %} +{% block content %} + +

Welcome!

+ +This is the Rophako CMS! + +{% endblock %} \ No newline at end of file diff --git a/rophako/www/layout.html b/rophako/www/layout.html new file mode 100644 index 0000000..1be983d --- /dev/null +++ b/rophako/www/layout.html @@ -0,0 +1,39 @@ + + + + {% block title %}{% endblock %} + + + + + +
+

Rophako

+
+ + + +
+ {% block content %}{% endblock %} +
+ +
+ + + + + \ No newline at end of file diff --git a/runserver.py b/runserver.py new file mode 100644 index 0000000..3642f13 --- /dev/null +++ b/runserver.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python + +from rophako import app +app.run(host='0.0.0.0', debug=True, port=2006) \ No newline at end of file diff --git a/site/www/.dummy b/site/www/.dummy new file mode 100644 index 0000000..e69de29