diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5752a9503ee923f3cc9eb8b4de4d097d37892554 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,12 @@ +from flask import Flask + +app = Flask(__name__) + +if app.config['ENV'] == 'production': + app.config.from_object('config.ProductionConfig') +else: + app.config.from_object('config.DevelopmentConfig') + + +from app import views + diff --git a/app/__init__.pyc b/app/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..410b8dab7703e7559075b6347b517f681fdee24c Binary files /dev/null and b/app/__init__.pyc differ diff --git a/app/__pycache__/__init__.cpython-35.pyc b/app/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9373d6da40e109906e704e4f94affa1526751893 Binary files /dev/null and b/app/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/__pycache__/views.cpython-35.pyc b/app/__pycache__/views.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..819879dc56dc101df484b92c31b9832b3d7195b8 Binary files /dev/null and b/app/__pycache__/views.cpython-35.pyc differ diff --git a/dao/__init__.py b/app/dao/__init__.py similarity index 100% rename from dao/__init__.py rename to app/dao/__init__.py diff --git a/dao/__init__.pyc b/app/dao/__init__.pyc similarity index 100% rename from dao/__init__.pyc rename to app/dao/__init__.pyc diff --git a/app/dao/__pycache__/__init__.cpython-35.pyc b/app/dao/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b83b65ea027c63404b5ab7c1243b22936b5c6cb4 Binary files /dev/null and b/app/dao/__pycache__/__init__.cpython-35.pyc differ diff --git a/dao/application/__init__.py b/app/dao/application/__init__.py similarity index 100% rename from dao/application/__init__.py rename to app/dao/application/__init__.py diff --git a/dao/application/__init__.pyc b/app/dao/application/__init__.pyc similarity index 100% rename from dao/application/__init__.pyc rename to app/dao/application/__init__.pyc diff --git a/app/dao/application/__pycache__/__init__.cpython-35.pyc b/app/dao/application/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4646c029634211268a912b9bf801a4f16d327690 Binary files /dev/null and b/app/dao/application/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/dao/application/__pycache__/application.cpython-35.pyc b/app/dao/application/__pycache__/application.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fcba2ee9e1ec78600d711fab859b6c068af2aaee Binary files /dev/null and b/app/dao/application/__pycache__/application.cpython-35.pyc differ diff --git a/dao/application/application.py b/app/dao/application/application.py similarity index 96% rename from dao/application/application.py rename to app/dao/application/application.py index e73fff593b01ab6bb9c0f3fb52ae688adc0846e6..eb667287b5539fdd435229b6e97bcd344a78082e 100644 --- a/dao/application/application.py +++ b/app/dao/application/application.py @@ -1,4 +1,4 @@ -from misc import with_psql +from app.helpers.misc import with_psql @with_psql def create(cur, name, appkey, username, desc): diff --git a/app/dao/application/application.pyc b/app/dao/application/application.pyc new file mode 100644 index 0000000000000000000000000000000000000000..352a37989f767cef7b7b40b0db1869071db5bd3b Binary files /dev/null and b/app/dao/application/application.pyc differ diff --git a/dao/data/__init__.py b/app/dao/data/__init__.py similarity index 100% rename from dao/data/__init__.py rename to app/dao/data/__init__.py diff --git a/dao/data/__init__.pyc b/app/dao/data/__init__.pyc similarity index 100% rename from dao/data/__init__.pyc rename to app/dao/data/__init__.pyc diff --git a/app/dao/data/__pycache__/__init__.cpython-35.pyc b/app/dao/data/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a04f23523e347cf01199f99267ee36db33d27dcc Binary files /dev/null and b/app/dao/data/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/dao/data/__pycache__/data.cpython-35.pyc b/app/dao/data/__pycache__/data.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e47847b8e7b29f942049680471a4957249f3398 Binary files /dev/null and b/app/dao/data/__pycache__/data.cpython-35.pyc differ diff --git a/dao/data/data.py b/app/dao/data/data.py similarity index 97% rename from dao/data/data.py rename to app/dao/data/data.py index e90aa00ba9a5fc3ef4fec21d02f4c7a5bb165de6..ae4c4e486294441e7e206fc33d1244cf3237158f 100644 --- a/dao/data/data.py +++ b/app/dao/data/data.py @@ -1,5 +1,5 @@ from psycopg2 import sql -from misc import with_psql +from app.helpers.misc import with_psql @with_psql diff --git a/dao/data/data.pyc b/app/dao/data/data.pyc similarity index 53% rename from dao/data/data.pyc rename to app/dao/data/data.pyc index 0d30c252be4add95c5b027b2987a3ace215ebba1..35a09e915ba22fa09c0777be9237a2bee08b1f04 100644 Binary files a/dao/data/data.pyc and b/app/dao/data/data.pyc differ diff --git a/dao/device/__init__.py b/app/dao/device/__init__.py similarity index 100% rename from dao/device/__init__.py rename to app/dao/device/__init__.py diff --git a/dao/device/__init__.pyc b/app/dao/device/__init__.pyc similarity index 100% rename from dao/device/__init__.pyc rename to app/dao/device/__init__.pyc diff --git a/app/dao/device/__pycache__/__init__.cpython-35.pyc b/app/dao/device/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4dfdd0a7b0a268d8e7184e5a2cbf207e7fee29af Binary files /dev/null and b/app/dao/device/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/dao/device/__pycache__/device.cpython-35.pyc b/app/dao/device/__pycache__/device.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a46775613e6ccb2ebc08f76a61682fc1275c4e31 Binary files /dev/null and b/app/dao/device/__pycache__/device.cpython-35.pyc differ diff --git a/dao/device/device.py b/app/dao/device/device.py similarity index 98% rename from dao/device/device.py rename to app/dao/device/device.py index 7485defdbc5564f75ba74e35baf6d74c74d6a6dc..d15abaa9f20d78cb0d2e8a3bcd84cc995a28066f 100644 --- a/dao/device/device.py +++ b/app/dao/device/device.py @@ -1,5 +1,5 @@ from psycopg2 import sql -from misc import with_psql +from app.helpers.misc import with_psql @with_psql def create_datatable(cur, appkey, dev_id): diff --git a/app/dao/device/device.pyc b/app/dao/device/device.pyc new file mode 100644 index 0000000000000000000000000000000000000000..71cdb920886dd00a872c88d6ec0f2f5a2bebc5a8 Binary files /dev/null and b/app/dao/device/device.pyc differ diff --git a/dao/pend/__init__.py b/app/dao/pend/__init__.py similarity index 100% rename from dao/pend/__init__.py rename to app/dao/pend/__init__.py diff --git a/dao/pend/__init__.pyc b/app/dao/pend/__init__.pyc similarity index 100% rename from dao/pend/__init__.pyc rename to app/dao/pend/__init__.pyc diff --git a/app/dao/pend/__pycache__/__init__.cpython-35.pyc b/app/dao/pend/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c91a7b1ac433c60b422d80c7e04cfd525953573 Binary files /dev/null and b/app/dao/pend/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/dao/pend/__pycache__/pend.cpython-35.pyc b/app/dao/pend/__pycache__/pend.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..405d036e8e02124b0f176f459bf2d2a26c3175ef Binary files /dev/null and b/app/dao/pend/__pycache__/pend.cpython-35.pyc differ diff --git a/dao/pend/pend.py b/app/dao/pend/pend.py similarity index 83% rename from dao/pend/pend.py rename to app/dao/pend/pend.py index f2365f2bd2121b4c8bb36205be82cfb8182e4ec1..6c2e2d5be18dbc7117ae508bbd3a31c00e52bd86 100644 --- a/dao/pend/pend.py +++ b/app/dao/pend/pend.py @@ -1,4 +1,4 @@ -from misc import with_psql +from app.helpers.misc import with_psql @with_psql def create(cur, appkey, devid, msg): diff --git a/app/dao/pend/pend.pyc b/app/dao/pend/pend.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1c1b5ec96370a58c98308d7b29577b31012416f6 Binary files /dev/null and b/app/dao/pend/pend.pyc differ diff --git a/dao/user/__init__.py b/app/dao/user/__init__.py similarity index 100% rename from dao/user/__init__.py rename to app/dao/user/__init__.py diff --git a/dao/user/__init__.pyc b/app/dao/user/__init__.pyc similarity index 100% rename from dao/user/__init__.pyc rename to app/dao/user/__init__.pyc diff --git a/app/dao/user/__pycache__/__init__.cpython-35.pyc b/app/dao/user/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..133eb1b57ebf5e46ae38de0acee0cb8349c536a1 Binary files /dev/null and b/app/dao/user/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/dao/user/__pycache__/user.cpython-35.pyc b/app/dao/user/__pycache__/user.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66dc809672dc6d0f896ac58eeed257dde23dc392 Binary files /dev/null and b/app/dao/user/__pycache__/user.cpython-35.pyc differ diff --git a/dao/user/user.py b/app/dao/user/user.py similarity index 96% rename from dao/user/user.py rename to app/dao/user/user.py index 606ca7d97b8ffbf7d0dc1de13a82ebb777d6c9d6..c2e53391eefaf9c185e1a284cc5445f95ba8c8aa 100644 --- a/dao/user/user.py +++ b/app/dao/user/user.py @@ -1,4 +1,4 @@ -from misc import with_psql +from app.helpers.misc import with_psql import bcrypt diff --git a/app/dao/user/user.pyc b/app/dao/user/user.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6f00ee1dc75183e4137299ff0e3ff8b82fb135c Binary files /dev/null and b/app/dao/user/user.pyc differ diff --git a/app/helpers/__init__.py b/app/helpers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/helpers/__init__.pyc b/app/helpers/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..78787277a09b8780210e327d720332b3f435d2f9 Binary files /dev/null and b/app/helpers/__init__.pyc differ diff --git a/app/helpers/__pycache__/__init__.cpython-35.pyc b/app/helpers/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2243b105e11c3df98c70c5ca283922abe7fc6b0 Binary files /dev/null and b/app/helpers/__pycache__/__init__.cpython-35.pyc differ diff --git a/app/helpers/__pycache__/misc.cpython-35.pyc b/app/helpers/__pycache__/misc.cpython-35.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0fa760c4e9b202e375a781745fbae3e127bf14d5 Binary files /dev/null and b/app/helpers/__pycache__/misc.cpython-35.pyc differ diff --git a/misc.py b/app/helpers/misc.py similarity index 78% rename from misc.py rename to app/helpers/misc.py index 8ae2bedbe5897ce36f64c8cdebe42ae22a234c2a..fdfc187b3f5788c36ad9831a5c78ce19bc03cd6b 100644 --- a/misc.py +++ b/app/helpers/misc.py @@ -1,3 +1,4 @@ +from app import app from binascii import hexlify import os import psycopg2 @@ -45,13 +46,13 @@ def prep_id_range(devlist): # decorator implementation def with_psql(f): def _with_psql(*args, **kwargs): - db_conf = read_json_file('db.conf') + #db_conf = read_json_file('db.conf') conn = psycopg2.connect( - database = db_conf['name'], - user = db_conf['user'], - password = db_conf['password'], - host = db_conf['host'], - port = db_conf['port'] + database = app.config['DB_NAME'],#db_conf['name'], + user = app.config['DB_USERNAME'],#db_conf['user'], + password = app.config['DB_PASSWORD'],#db_conf['password'], + host = app.config['DB_HOST'],#db_conf['host'], + port = app.config['DB_PORT']#db_conf['port'] ) cur = conn.cursor() @@ -74,7 +75,7 @@ def read_json_file(path): try: with open(path) as json_file: json_dict = json.load(json_file) - except Exception, e: + except Exception as e: print("{} : {}".format(path, e)) return json_dict diff --git a/app/helpers/misc.pyc b/app/helpers/misc.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4c442d14caa95b07d4a76f21d13ba2951ee90c26 Binary files /dev/null and b/app/helpers/misc.pyc differ diff --git a/static/custom.css b/app/static/css/custom.css similarity index 100% rename from static/custom.css rename to app/static/css/custom.css diff --git a/templates/layout.html b/app/templates/layout.html similarity index 92% rename from templates/layout.html rename to app/templates/layout.html index a80f66b621a231ae683edc9c9677208daf15a61d..aa573e9e3b4f6511ff35e086e8aad567c253f23d 100644 --- a/templates/layout.html +++ b/app/templates/layout.html @@ -6,7 +6,7 @@