@@ -1,3 +1,6 @@ | |||||
.sass-cache | |||||
# github premade rules | |||||
*.py[cod] | *.py[cod] | ||||
# C extensions | # C extensions | ||||
@@ -1,7 +1,22 @@ | |||||
""" | |||||
Module to contain all the project's Flask server plumbing. | |||||
""" | |||||
from flask import Flask | from flask import Flask | ||||
from flask import render_template, session | |||||
from bitshift import * | |||||
app = Flask(__name__) | app = Flask(__name__) | ||||
app.secret_key = "\x03#\xa8\xf3!\xddHd\x11\x8dx\xd9mR\xb2\xfb\x89LH^\x05\xe7\xc6F" | |||||
app.config.from_object("bitshift.config") | |||||
app_env = app.jinja_env | |||||
app_env.line_statement_prefix = "=" | |||||
app_env.globals.update(assets = assets) | |||||
@app.route("/") | |||||
def index(): | |||||
return render_template("index.html") | |||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
app.run(debug=True) | |||||
app.run() |
@@ -0,0 +1 @@ | |||||
__all__ = ["config", "assets"] |
@@ -0,0 +1,22 @@ | |||||
""" | |||||
Module contains helper functions to be used inside the project's Jinja | |||||
templates. | |||||
""" | |||||
from flask import Markup | |||||
ASSET_HTML_TEMPLATES = { | |||||
'css': "<link rel='stylesheet' type='text/css' href='/static/css/%s'>", | |||||
'js': "<script src='/static/js/%s'></script>" | |||||
} | |||||
def tag(filename): | |||||
""" | |||||
Return HTML tag for asset named filename. | |||||
Return either a <script> or <link> tag to the file named filename, | |||||
based on its extension. | |||||
""" | |||||
file_ext = filename.split(".")[-1] | |||||
return Markup(ASSET_HTML_TEMPLATES[file_ext] % filename) |
@@ -0,0 +1,6 @@ | |||||
""" | |||||
Module to contain definitions of all Flask variables required by the app module. | |||||
""" | |||||
DEBUG = True | |||||
SECRET_KEY = "\x89\x87\x9a9\xab{\xda\xfe.28\xb4\x18\x01\x95]]\xd2\xeaen\xe0Ot" |
@@ -0,0 +1,4 @@ | |||||
/* Global project stylesheet. | |||||
*/ | |||||
p { | |||||
font-size: 1.5em; } |
@@ -0,0 +1,11 @@ | |||||
/* | |||||
Partial to contain all globally-applicable mixins | |||||
*/ | |||||
// add vendor prefixes for the property $property with value $value | |||||
@mixin vendor($property, $value) | |||||
-webkit-#{$property}: $value | |||||
-moz-#{$property}: $value | |||||
-ms-#{$property}: $value | |||||
-o-#{$property}: $value | |||||
#{$property}: $value |
@@ -0,0 +1,7 @@ | |||||
/* | |||||
Global project stylesheet. | |||||
*/ | |||||
// placeholder | |||||
p | |||||
font-size: 1.5em |
@@ -0,0 +1,9 @@ | |||||
= extends "layout.html" | |||||
= block title | |||||
Home | |||||
= endblock | |||||
= block body | |||||
<p>Hello, world.</p> | |||||
= endblock |
@@ -0,0 +1,27 @@ | |||||
<!DOCTYPE html> | |||||
<!-- Global layout template, to be inherited by other project HTML files. --> | |||||
<html> | |||||
<head> | |||||
<title> | |||||
= block title | |||||
= endblock | |||||
</title> | |||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | |||||
<meta name="description" content="bitshift is an online code snippet | |||||
exchange."/> | |||||
<meta name="keywords" content="code snippet exchange golf programming | |||||
software community"/> | |||||
<meta name="author" content="Benjamin Attal Ben Kurtovic Severyn Kozak"/> | |||||
{{ assets.tag("main.css") }} | |||||
= block head | |||||
= endblock | |||||
</head> | |||||
<body> | |||||
= block body | |||||
= endblock | |||||
</body> | |||||
</html> |