Merge branch 'master' of github.com:ZeusWPI/James
Conflicts: app/app.py app/james.py
This commit is contained in:
commit
24c5da72f6
3 changed files with 42 additions and 23 deletions
22
app/app.py
22
app/app.py
|
@ -1,3 +1,5 @@
|
|||
import logging
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
from flask import Flask
|
||||
from flask.ext.bootstrap import Bootstrap, StaticCDN
|
||||
from flask.ext.sqlalchemy import SQLAlchemy
|
||||
|
@ -12,3 +14,23 @@ app.extensions['bootstrap']['cdns']['bootstrap'] = StaticCDN()
|
|||
|
||||
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')
|
||||
timedFileHandler = TimedRotatingFileHandler(app.config['LOGFILE'], when='midnight', backupCount=100)
|
||||
timedFileHandler.setLevel(logging.INFO)
|
||||
logger = logging.getLogger('werkzeug')
|
||||
logger.addHandler(timedFileHandler)
|
||||
app.logger.addHandler(timedFileHandler)
|
||||
|
|
|
@ -16,22 +16,6 @@ db.session.add(destro)
|
|||
iepoev = User()
|
||||
iepoev.configure('iepoev', True, 1)
|
||||
db.session.add(iepoev)
|
||||
|
||||
burrito = Location()
|
||||
burrito.configure("Burrito Bar", "Top-4-straat Keknet-city", "burritofest.com")
|
||||
db.session.add(burrito)
|
||||
|
||||
blauw_kotje = Location()
|
||||
blauw_kotje.configure("'t Blauw Kotje", "Top-5-straat Keknet-city", "frietfest.com")
|
||||
db.session.add(blauw_kotje)
|
||||
|
||||
chili_con_carne = Product()
|
||||
chili_con_carne.configure(burrito, "Chili Con Carne", 550)
|
||||
db.session.add(chili_con_carne)
|
||||
|
||||
medium_pak_frieten = Product()
|
||||
medium_pak_frieten.configure(blauw_kotje, "Medium Pak Frieten", 220)
|
||||
db.session.add(medium_pak_frieten)
|
||||
# To future developers, add yourself here
|
||||
|
||||
############################################
|
||||
|
@ -45,7 +29,7 @@ specials = ["Kippenbolletjes zoetzuur", "varkenbolletjes zoetzuur", "Nazi Babi P
|
|||
"Diverse groenten met bami(Vegetarisch)", "Diverse groenten met nazi(Vegetarisch)"]
|
||||
|
||||
chinees = Location()
|
||||
chinees.configure("Oceans's Garden", "Top-4-straat Keknet-city", "http://oceangarden.byethost3.com/studentenmenus.html")
|
||||
chinees.configure("Oceans's Garden", "Zwijnaardsesteenweg 399 9000 Gent, tel: 09/222.72.74", "http://oceangarden.byethost3.com/studentenmenus.html")
|
||||
db.session.add(chinees)
|
||||
|
||||
def chinees_create_entry(zetmeel, vlees="", saus=""):
|
||||
|
@ -61,5 +45,22 @@ for special in specials:
|
|||
chinees_create_entry(special)
|
||||
#############################################
|
||||
|
||||
############################################
|
||||
# Simpizza autogenerate #
|
||||
############################################
|
||||
pizzas = ['Bolognese de luxe', 'Hawaï', 'Popeye', 'Pepperoni', 'Seafood', 'Hot pizzaaah!!!', 'Salmon delight',
|
||||
'Full option', 'Pitza kebab', 'Multi cheese', '4 Seasons', 'Mega fish', 'Creamy multi cheese',
|
||||
'Green fiësta', 'Chicken bbq', 'Funky chicken', 'Veggie', 'Meat lovers', 'Scampi mampi', 'Tabasco',
|
||||
'Chicken time', 'Meatballs', 'Tuna', 'Anchovy', 'Calzone', 'Bbq meatballs', 'Creamy chicken', 'Hot bolognese']
|
||||
|
||||
simpizza = Location()
|
||||
simpizza.configure("Sim-pizza", "De Pintelaan 252 9000 Gent, tel: 09/321.02.00", "http://simpizza.be")
|
||||
db.session.add(simpizza)
|
||||
|
||||
for pizza in pizzas:
|
||||
entry = Product()
|
||||
entry.configure(simpizza, pizza, 1195)
|
||||
db.session.add(entry)
|
||||
|
||||
# commit all the things
|
||||
db.session.commit()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from views import *
|
||||
|
||||
from app import app, db
|
||||
from app import app, db, logger
|
||||
|
||||
from admin import admin
|
||||
from login import login_manager
|
||||
|
@ -9,8 +9,4 @@ from forms import *
|
|||
from utils import *
|
||||
from views import *
|
||||
|
||||
|
||||
if app.debug:
|
||||
app.run(host='0.0.0.0', port=80)
|
||||
else:
|
||||
app.run()
|
||||
app.run()
|
||||
|
|
Loading…
Reference in a new issue