Skip to content
This repository has been archived by the owner on Mar 30, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rewasder committed Apr 22, 2019
2 parents 030a1bc + 51872d8 commit 221f361
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions loaders/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@
# -*- coding: utf-8 -*-
# Authors: Luis Carles Durá, Jaime García Velázquez, Manuel Martín Malagón, Rafael Rodríguez Sánchez
# Created: 2019/04/11
# Last update: 2019/04/16
# Last update: 2019/04/22


import json
import os


class DataLoader:

def __init__(self):
try:
self.PORT = os.environ.get('PORT', '5000')
with open('data/products.json', encoding='utf-8') as data:
self.products = json.load(data)
with open('data/product_categories.json', encoding='utf-8') as data:
Expand All @@ -25,4 +28,4 @@ def __init__(self):
self.order_states = json.load(data)
except:
print("Error while reading web application data.")
raise
raise
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Flask==1.0.2
Flask==1.0.2
flask-sslify==0.1.5
7 changes: 6 additions & 1 deletion web.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from flask import Flask, flash, redirect, render_template, request, session, abort, send_from_directory
from loaders.data_loader import DataLoader
from flask_sslify import SSLify


try:
data = DataLoader()
Expand All @@ -19,6 +21,9 @@

app = Flask(__name__)

if 'DYNO' in os.environ: # only trigger SSLify if the app is running on Heroku
sslify = SSLify(app)


def order_has_pending_record(order_id):
has_pending_record = False
Expand Down Expand Up @@ -496,4 +501,4 @@ def customer_order_summary(num_table, num_order):


if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
app.run(host="0.0.0.0", port=int(data.PORT))

0 comments on commit 221f361

Please sign in to comment.