diff --git a/config.json b/config.json index a43c162..956e6f8 100644 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"TITLE": "pyShelf E-Book Server", "VERSION": "0.6.0", "BOOKPATH": "~/books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "SECRET": ""} +{"TITLE": "pyShelf E-Book Server", "VERSION": "0.6.0", "BOOKPATH": "~/books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "SECRET": "", "BUILD_MODE": "DEBUG"} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 7b4a6c6..684d71e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ # Use the following commands to build and push the docker image to Dockerhub: # -# docker build -t pyshelf/pyshelf -f .\docker\Dockerfile . +# docker build -t pyshelf/pyshelf -f ./docker/Dockerfile . # docker login # docker push pyshelf/pyshelf diff --git a/docker/development.docker-compose.yml b/docker/development.docker-compose.yml index 995a7be..c395f78 100644 --- a/docker/development.docker-compose.yml +++ b/docker/development.docker-compose.yml @@ -6,7 +6,7 @@ version: "3.7" # For development, use the following command in the root folder: # -# docker-compose -f .\docker\development.docker-compose.yml up --build +# docker-compose -f ./docker/development.docker-compose.yml up --build services: db: diff --git a/requirements.txt b/requirements.txt index c14ff50..962868d 100755 --- a/requirements.txt +++ b/requirements.txt @@ -21,3 +21,4 @@ mobi-python uwsgi jsonpickle django-widget-tweaks +pudb diff --git a/src/backend/lib/config.py b/src/backend/lib/config.py index dfa3636..d5aa5cc 100755 --- a/src/backend/lib/config.py +++ b/src/backend/lib/config.py @@ -37,6 +37,7 @@ class Config: self.db_user = _data["USER"] self.db_pass = _data["PASSWORD"] self.SECRET = _data["SECRET"] + self.debug_build_mode = (_data["BUILD_MODE"].casefold() == "debug") def open_file(self, _cp): """ diff --git a/src/frontend/settings.py b/src/frontend/settings.py index 0cb56e8..6e1a91d 100755 --- a/src/frontend/settings.py +++ b/src/frontend/settings.py @@ -32,8 +32,9 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = CONFIG.SECRET # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = TEMPLATE_DEBUG = False +DEBUG = TEMPLATE_DEBUG = CONFIG.debug_build_mode if DEBUG is True: + print("DEBUG build mode is ON") from pudb.remote import set_trace ALLOWED_HOSTS = CONFIG.allowed_hosts