From 0c35a4a008db709c23b2ebf9b1947a3c7eb03ae1 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 18 Nov 2018 21:00:11 +0100 Subject: [PATCH] Drop python-dotenv and load straight form Pipenv + xppl.config. --- Pipfile | 1 - Pipfile.lock | 10 +--------- xppl/app.py | 9 +-------- xppl/config.py | 3 ++- 4 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Pipfile b/Pipfile index 00d4ff1..a82583e 100644 --- a/Pipfile +++ b/Pipfile @@ -15,7 +15,6 @@ flask-wtf = "*" gunicorn = "*" marshmallow = "*" pyrqlite = {git = "https://github.com/rqlite/pyrqlite.git"} -python-dotenv = "*" requests = "*" sqlalchemy-rqlite = {git = "https://github.com/rqlite/sqlalchemy-rqlite.git"} wand = "*" diff --git a/Pipfile.lock b/Pipfile.lock index f4ee0fc..de1c692 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "61237413ec4bbfe6f01892041e07854eee51ea334dbb78852c065c9cd50b4536" + "sha256": "a35be8aef6002cbae949a73ffb88c1b482994149c663455c3f31421cd465d388" }, "pipfile-spec": 6, "requires": {}, @@ -333,14 +333,6 @@ "git": "https://github.com/rqlite/pyrqlite.git", "ref": "f8cd41e0522af36a234088b3c876ccfc5078f662" }, - "python-dotenv": { - "hashes": [ - "sha256:122290a38ece9fe4f162dc7c95cae3357b983505830a154d3c98ef7f6c6cea77", - "sha256:4a205787bc829233de2a823aa328e44fd9996fedb954989a21f1fc67c13d7a77" - ], - "index": "pypi", - "version": "==0.9.1" - }, "python-engineio": { "hashes": [ "sha256:306a91fda59e3678b34755f475ff6b5b3dc0deb0272a23e213f2f259b5602c4c", diff --git a/xppl/app.py b/xppl/app.py index 31b60bb..8366d11 100644 --- a/xppl/app.py +++ b/xppl/app.py @@ -1,9 +1,8 @@ """Main application factory.""" -from os import makedirs +from os import makedirs, pardir from os.path import exists -from dotenv import find_dotenv, load_dotenv from flask import Flask from sqlalchemy.dialects import registry @@ -13,7 +12,6 @@ def create_app(config): app.config.from_object(config) - configure_dotenv() configure_pyrqlite() configure_socketio(app) configure_sqlalchemy(app) @@ -34,11 +32,6 @@ def configure_pyrqlite(): ) -def configure_dotenv(): - """Configure the environment.""" - load_dotenv(find_dotenv()) - - def configure_sqlalchemy(app): """Configure SQLAlchemy.""" from xppl.database import db diff --git a/xppl/config.py b/xppl/config.py index 9de87af..1790c1b 100644 --- a/xppl/config.py +++ b/xppl/config.py @@ -1,6 +1,6 @@ """The Application settings.""" -from os import urandom +from os import getenv, urandom from os.path import abspath, dirname, isdir, join BASEDIR = abspath(dirname(__file__)) @@ -15,6 +15,7 @@ class Base(): UPLOAD_FOLDER_COVER = join(BASEDIR, 'cover') UPLOAD_FOLDER = join(BASEDIR, 'uploads') LIGHT = not isdir(UPLOAD_FOLDER) + SECRET_KEY = getenv('SECRET_KEY') class Production(Base):