Foodbot is dead, long live James

This commit is contained in:
Feliciaan De Palmenaer 2015-03-31 00:06:09 +02:00
parent 0a546f8aa9
commit 5677986378
5 changed files with 25 additions and 7 deletions

View file

@ -27,7 +27,7 @@ class LocationAdminModel(ModelBaseView):
form_columns = ('name', 'address', 'website') form_columns = ('name', 'address', 'website')
admin = Admin(app, name='FoodBot', url='/admin', template_mode='bootstrap3') admin = Admin(app, name='James', url='/admin', template_mode='bootstrap3')
admin.add_view(UserAdminModel(User, db.session)) admin.add_view(UserAdminModel(User, db.session))

View file

@ -8,3 +8,18 @@ app.config.from_object('config.Configuration')
Bootstrap(app) Bootstrap(app)
db = SQLAlchemy(app) db = SQLAlchemy(app)
class PrefixFix(object):
def __init__(self, app, script_name):
self.app = app
self.script_name = script_name
def __call__(self, environ, start_response):
path = environ.get('SCRIPT_NAME', '') + environ.get('PATH_INFO', '')
environ['SCRIPT_NAME'] = self.script_name
environ['PATH_INFO'] = path[len(self.script_name):]
return self.app(environ, start_response)
if not app.debug:
app.wsgi_app = PrefixFix(app.wsgi_app, '/james')

View file

@ -2,10 +2,10 @@
class Configuration(object): class Configuration(object):
SQLALCHEMY_DATABASE_URI = 'sqlite:///foodbot.db' SQLALCHEMY_DATABASE_URI = 'sqlite:///james.db'
DEBUG = True DEBUG = True
SECRET_KEY = '<change>' SECRET_KEY = '<change>'
SLACK_WEBHOOK = '<add url>' SLACK_WEBHOOK = '<add url>'
LOGFILE = 'foodbot.log' LOGFILE = 'james.log'
ZEUS_KEY = '' ZEUS_KEY = ''
ZEUS_SECRET = '' ZEUS_SECRET = ''

View file

@ -14,5 +14,8 @@ from forms import *
from utils import * from utils import *
from views import * from views import *
if __name__ == '__main__': if __name__ == '__main__':
app.run() app.run(host='0.0.0.0', port=80)

View file

@ -37,7 +37,7 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="{{ url_for('home') }}">FOODBOT</a> <a class="navbar-brand" href="{{ url_for('home') }}">JAMES</a>
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
@ -72,8 +72,8 @@
<hr> <hr>
<div class="container"> <div class="container">
<div class="pull-right">Made with ❤ by <a href="http://zeus.ugent.be">Zeus WPI</a></div> <div class="pull-right">Made with ❤ by <a href="http://zeus.ugent.be">Zeus WPI</a></div>
<div class="pull-left"><a class="github-button" href="https://github.com/ZeusWPI/FoodBot" data-icon="octicon-star" data-style="mega" data-count-href="/ZeusWPI/FoodBot/stargazers" data-count-api="/repos/ZeusWPI/FoodBot#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star ZeusWPI/FoodBot on GitHub">Star</a></div> <div class="pull-left"><a class="github-button" href="https://github.com/ZeusWPI/james" data-icon="octicon-star" data-style="mega" data-count-href="/ZeusWPI/James/stargazers" data-count-api="/repos/ZeusWPI/James#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star ZeusWPI/James on GitHub">Star</a></div>
<div class="text-center">© {{ ""|year }}<a href="http://github.com/ZeusWPI/FoodBot"></a></div> <div class="text-center"><a href="http://github.com/ZeusWPI/James">© {{ ""|year }}</a></div>
</div> </div>
</footer> </footer>
{%- endblock %} {%- endblock %}