trying to fix globals

This commit is contained in:
JesseBot 2015-10-22 19:53:54 +00:00
parent 1707be11bc
commit 7d83233828
5 changed files with 41 additions and 7 deletions

11
css/bootstrap.min.css vendored Executable file

File diff suppressed because one or more lines are too long

View file

@ -6,6 +6,12 @@ body {
text-align: center;
}
.center {
float: none;
margin-left: auto;
margin-right: auto;
}
.rotate90 {
-webkit-transform: rotate(90deg);

View file

@ -1,51 +1,60 @@
# production jessebot.com python file
import lib
import logging
from bottle import redirect, request, response, route
from bottle import run, static_file, template
import sys
import yaml
stream = open(config.yaml)
WEB_ROOT = ""
WEB_ROOT = get_global_variable(WEB_ROOT)
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
logging.info("logging config loaded")
@route('/')
def index():
return template('index')
@route('/contact')
def contact():
return template('contact')
@route('/about')
def about():
return template('about')
@route('/legacy')
def legacy():
redirect ("http://legacy.jessebot.com")
@route('/hate')
def hate():
return template('hate')
@route('/photo')
@route('/photo/')
def photo():
redirect('http://photo.jessebot.com')
@route('/images/<filename>')
def images(filename):
return static_file(filename, root='WEB_ROOT/{0}'.format(images))
return static_file(filename, root='{0}/images'.format(WEB_ROOT))
@route('/js/<filename>')
def js(filename):
return static_file(filename, root='WEB_ROOT/{0}'.format(js))
return static_file(filename, root='{0}/js'.format(WEB_ROOT))
@route('/css/<filename>')
def css(filename):
return static_file(filename, root='WEB_ROOT/{0}'.format(css))
return static_file(filename, root='{0}/css'.format(WEB_ROOT))

8
lib.py Normal file
View file

@ -0,0 +1,8 @@
import yaml
def get_global_variable(global_variable):
""" gets global variable given string variable name"""
with open('./config.yaml', 'r') as f:
doc = yaml.load(f)
txt = doc["Global"][global_variable]
return txt

View file

@ -11,10 +11,10 @@
<title>JesseBot.com</title>
<!-- Custom styles for this template -->
<link href="css/starter-template.css" rel="stylesheet">
<!--<link href="css/starter-template.css" rel="stylesheet">-->
<!-- Bootstrap core CSS -->
<link href="css/bootstrap_flatdark.min.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>