nginx unit works
This commit is contained in:
		@@ -23,9 +23,10 @@ with open(BASE_DIR + "/settings.json", "r") as userfile:
 | 
			
		||||
    CALIBRE_DIR = os.path.abspath(usersettings["CALIBRE_DIR"])
 | 
			
		||||
    SECRET_KEY = usersettings["SECRET_KEY"]
 | 
			
		||||
    ALLOWED_HOSTS = usersettings["ALLOWED_HOSTS"]
 | 
			
		||||
    INTERNAL_IPS = usersettings["INTERNAL_IPS"]
 | 
			
		||||
    DEBUG = usersettings["DEBUG"]
 | 
			
		||||
 | 
			
		||||
DOCKER = os.environ.get('AM_DOCKER_INSTANCE', False)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 | 
			
		||||
 | 
			
		||||
@@ -64,38 +65,41 @@ STATIC_ROOT = BASE_DIR + "/static/"
 | 
			
		||||
#########################################################################
 | 
			
		||||
# LOGGING
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# logfile = usersettings["LOGFOLDER"] + "django.log"
 | 
			
		||||
# LOGGING = {
 | 
			
		||||
#     "version": 1,
 | 
			
		||||
#     "disable_existing_loggers": False,
 | 
			
		||||
#     "root": {"level": "INFO", "handlers": ["file"]},
 | 
			
		||||
#     "handlers": {
 | 
			
		||||
#         "file": {
 | 
			
		||||
#             "level": "INFO",
 | 
			
		||||
#             "class": "logging.FileHandler",
 | 
			
		||||
#             "filename": logfile,
 | 
			
		||||
#             "formatter": "app",
 | 
			
		||||
# TODO: think about the issue for a bit. no write access to file on first run
 | 
			
		||||
# but startscript doesn't run to give access if it can't start django
 | 
			
		||||
# if not DOCKER: 
 | 
			
		||||
#     logfile = "/app//data//django.log"
 | 
			
		||||
#     if not os.path.isfile(logfile):
 | 
			
		||||
#         os.mknod(logfile)
 | 
			
		||||
#     LOGGING = {
 | 
			
		||||
#         "version": 1,
 | 
			
		||||
#         "disable_existing_loggers": False,
 | 
			
		||||
#         "root": {"level": "INFO", "handlers": ["file"]},
 | 
			
		||||
#         "handlers": {
 | 
			
		||||
#             "file": {
 | 
			
		||||
#                 "level": "INFO",
 | 
			
		||||
#                 "class": "logging.FileHandler",
 | 
			
		||||
#                 "filename": logfile,
 | 
			
		||||
#                 "formatter": "app",
 | 
			
		||||
#             },
 | 
			
		||||
#         },
 | 
			
		||||
#     },
 | 
			
		||||
#     "loggers": {
 | 
			
		||||
#         "django": {
 | 
			
		||||
#             "handlers": ["file"],
 | 
			
		||||
#             "level": "INFO",
 | 
			
		||||
#             "propagate": True
 | 
			
		||||
#         "loggers": {
 | 
			
		||||
#             "django": {
 | 
			
		||||
#                 "handlers": ["file"],
 | 
			
		||||
#                 "level": "INFO",
 | 
			
		||||
#                 "propagate": True
 | 
			
		||||
#             },
 | 
			
		||||
#         },
 | 
			
		||||
#     },
 | 
			
		||||
#     "formatters": {
 | 
			
		||||
#         "app": {
 | 
			
		||||
#             "format": (
 | 
			
		||||
#                 u"%(asctime)s [%(levelname)-8s] "
 | 
			
		||||
#                 "(%(module)s.%(funcName)s) %(message)s"
 | 
			
		||||
#             ),
 | 
			
		||||
#             "datefmt": "%Y-%m-%d %H:%M:%S",
 | 
			
		||||
#         "formatters": {
 | 
			
		||||
#             "app": {
 | 
			
		||||
#                 "format": (
 | 
			
		||||
#                     u"%(asctime)s [%(levelname)-8s] "
 | 
			
		||||
#                     "(%(module)s.%(funcName)s) %(message)s"
 | 
			
		||||
#                 ),
 | 
			
		||||
#                 "datefmt": "%Y-%m-%d %H:%M:%S",
 | 
			
		||||
#             },
 | 
			
		||||
#         },
 | 
			
		||||
#     },
 | 
			
		||||
# }
 | 
			
		||||
#     }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
##                                                                    ##
 | 
			
		||||
@@ -190,19 +194,23 @@ WSGI_APPLICATION = 'CalibreWebCompanion.wsgi.application'
 | 
			
		||||
##                    DATBASE                                         ##
 | 
			
		||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
 | 
			
		||||
 | 
			
		||||
if usersettings["ISDOCKER"]:
 | 
			
		||||
    defaultdb_path = "/usr/src/app/data/"
 | 
			
		||||
 | 
			
		||||
if DOCKER:
 | 
			
		||||
    djangodb_path = "/app/CalibreWebCompanion"
 | 
			
		||||
    calibredb_path = "/app/content/"
 | 
			
		||||
    
 | 
			
		||||
else:
 | 
			
		||||
    defaultdb_path = BASE_DIR
 | 
			
		||||
    djangodb_path = BASE_DIR
 | 
			
		||||
    calibredb_path = CALIBRE_DIR
 | 
			
		||||
 | 
			
		||||
DATABASES = {
 | 
			
		||||
    'default': {
 | 
			
		||||
        'ENGINE': 'django.db.backends.sqlite3',
 | 
			
		||||
        'NAME': os.path.join(defaultdb_path, 'db.sqlite3'),
 | 
			
		||||
        'NAME': os.path.join(djangodb_path, 'db.sqlite3'),
 | 
			
		||||
    },
 | 
			
		||||
    'calibre': {
 | 
			
		||||
        'ENGINE': 'django.db.backends.sqlite3',
 | 
			
		||||
        'NAME': os.path.join(CALIBRE_DIR, 'metadata.db'),
 | 
			
		||||
        'NAME': os.path.join(calibredb_path, 'metadata.db'),
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
<div class="col s12 m7">
 | 
			
		||||
  <div class="card z-depth-0 horizontal">
 | 
			
		||||
    <div class="card-image">
 | 
			
		||||
      <a style="padding-top:15%" href=" /download/{{download}}"><img src=" /download/{{imgpath}}"
 | 
			
		||||
      <a style="padding-top:15%" href=" /content/{{download}}"><img src=" /content/{{imgpath}}"
 | 
			
		||||
          alt="download" srcset=""></a>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="card-stacked">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
    "CALIBRE_DIR": "/usr/src/app/calibredir",
 | 
			
		||||
    "CALIBRE_DIR": "/app/content",
 | 
			
		||||
    "LOGFOLDER" : "/usr/src/app/data/logs/",
 | 
			
		||||
    "SECRET_KEY": "u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+",
 | 
			
		||||
    "ALLOWED_HOSTS": [
 | 
			
		||||
        "127.0.0.1"
 | 
			
		||||
        "*"
 | 
			
		||||
    ],
 | 
			
		||||
    "INTERNAL_IPS": [
 | 
			
		||||
        "127.0.0.1"
 | 
			
		||||
        "127.0.0.1", "localhost"
 | 
			
		||||
    ],
 | 
			
		||||
    "DEBUG" : true,
 | 
			
		||||
    "LOGFOLDER" : "/usr/src/app/data/logs/",
 | 
			
		||||
    "ISDOCKER" : true
 | 
			
		||||
 | 
			
		||||
    "DEBUG" : false
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user