From 1151671aba4666beac26e4b48de901d0307143cd Mon Sep 17 00:00:00 2001 From: Gilles Jacobs Date: Mon, 30 Mar 2015 23:53:21 +0200 Subject: [PATCH 1/2] JAMES --- app/templates/about.html | 4 ++-- app/templates/home.html | 6 +++--- app/templates/layout.html | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/templates/about.html b/app/templates/about.html index b2732d5..130501f 100644 --- a/app/templates/about.html +++ b/app/templates/about.html @@ -3,5 +3,5 @@ {% block container %}

About

-

This is an About page for FoodBot. Don't I look good? Oh stop, you're making me blush.

-{% endblock %} \ No newline at end of file +

This is James' about page. Doesn't he look good? Oh stop, you're making him blush.

+{% endblock %} diff --git a/app/templates/home.html b/app/templates/home.html index 21cf791..02b80d6 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -5,8 +5,8 @@ {% block container %}
-

Welcome to FoodBot

-

This is the home page for FoodBot

+

Hi, I'm James

+

What would you like to eat, sir?

@@ -23,4 +23,4 @@
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/templates/layout.html b/app/templates/layout.html index 7c0473e..950eadc 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -13,7 +13,7 @@ {% set active_page = active_page|default('index') -%} {% block title %} - FoodBot - {{ active_page|capitalize }} + James - {{ active_page|capitalize }} {% endblock %} {% block styles %} From 5677986378733226a3466d128d43ac6870ee493d Mon Sep 17 00:00:00 2001 From: Feliciaan De Palmenaer Date: Tue, 31 Mar 2015 00:06:09 +0200 Subject: [PATCH 2/2] Foodbot is dead, long live James --- app/admin.py | 2 +- app/app.py | 15 +++++++++++++++ app/config.example.py | 4 ++-- app/{foodbot.py => james.py} | 5 ++++- app/templates/layout.html | 6 +++--- 5 files changed, 25 insertions(+), 7 deletions(-) rename app/{foodbot.py => james.py} (89%) diff --git a/app/admin.py b/app/admin.py index b2f8123..47629ab 100644 --- a/app/admin.py +++ b/app/admin.py @@ -27,7 +27,7 @@ class LocationAdminModel(ModelBaseView): 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)) diff --git a/app/app.py b/app/app.py index c4e09cd..5041cc1 100644 --- a/app/app.py +++ b/app/app.py @@ -8,3 +8,18 @@ app.config.from_object('config.Configuration') Bootstrap(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') \ No newline at end of file diff --git a/app/config.example.py b/app/config.example.py index 7ca46e2..6fe57ee 100644 --- a/app/config.example.py +++ b/app/config.example.py @@ -2,10 +2,10 @@ class Configuration(object): - SQLALCHEMY_DATABASE_URI = 'sqlite:///foodbot.db' + SQLALCHEMY_DATABASE_URI = 'sqlite:///james.db' DEBUG = True SECRET_KEY = '' SLACK_WEBHOOK = '' - LOGFILE = 'foodbot.log' + LOGFILE = 'james.log' ZEUS_KEY = '' ZEUS_SECRET = '' diff --git a/app/foodbot.py b/app/james.py similarity index 89% rename from app/foodbot.py rename to app/james.py index 92df91e..d4fbb1b 100644 --- a/app/foodbot.py +++ b/app/james.py @@ -14,5 +14,8 @@ from forms import * from utils import * from views import * + + + if __name__ == '__main__': - app.run() + app.run(host='0.0.0.0', port=80) diff --git a/app/templates/layout.html b/app/templates/layout.html index 950eadc..f8a4b1d 100644 --- a/app/templates/layout.html +++ b/app/templates/layout.html @@ -37,7 +37,7 @@ - FOODBOT + JAMES