mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Merge pull request #148 from jbogatay/master
Allow database location to be variable
This commit is contained in:
		
						commit
						b7209a19b2
					
				@ -80,3 +80,8 @@ PAPERLESS_SHARED_SECRET=""
 | 
				
			|||||||
# For more information on how to use this value, you should probably search
 | 
					# For more information on how to use this value, you should probably search
 | 
				
			||||||
# the web for "MAGICK_TMPDIR".
 | 
					# the web for "MAGICK_TMPDIR".
 | 
				
			||||||
#PAPERLESS_CONVERT_TMPDIR=/var/tmp/paperless
 | 
					#PAPERLESS_CONVERT_TMPDIR=/var/tmp/paperless
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# You can specify where you want the SQLite database to be stored instead of 
 | 
				
			||||||
 | 
					# the default location
 | 
				
			||||||
 | 
					#PAPERLESS_DBDIR=/path/to/database/file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -31,6 +31,11 @@ LOGIN_URL = '/admin/login'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ALLOWED_HOSTS = []
 | 
					ALLOWED_HOSTS = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Tap paperless.conf if it's available
 | 
				
			||||||
 | 
					if os.path.exists("/etc/paperless.conf"):
 | 
				
			||||||
 | 
					    load_dotenv("/etc/paperless.conf")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Application definition
 | 
					# Application definition
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -90,9 +95,16 @@ WSGI_APPLICATION = 'paperless.wsgi.application'
 | 
				
			|||||||
DATABASES = {
 | 
					DATABASES = {
 | 
				
			||||||
    "default": {
 | 
					    "default": {
 | 
				
			||||||
        "ENGINE": "django.db.backends.sqlite3",
 | 
					        "ENGINE": "django.db.backends.sqlite3",
 | 
				
			||||||
        "NAME": os.path.join(BASE_DIR, "..", "data", "db.sqlite3"),
 | 
					        "NAME": os.path.join(
 | 
				
			||||||
 | 
					                    os.getenv(
 | 
				
			||||||
 | 
					                        "PAPERLESS_DBDIR",
 | 
				
			||||||
 | 
					                        os.path.join(BASE_DIR, "..", "data")
 | 
				
			||||||
 | 
					                    ),
 | 
				
			||||||
 | 
					                    "db.sqlite3"
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if os.getenv("PAPERLESS_DBUSER") and os.getenv("PAPERLESS_DBPASS"):
 | 
					if os.getenv("PAPERLESS_DBUSER") and os.getenv("PAPERLESS_DBPASS"):
 | 
				
			||||||
    DATABASES["default"] = {
 | 
					    DATABASES["default"] = {
 | 
				
			||||||
        "ENGINE": "django.db.backends.postgresql_psycopg2",
 | 
					        "ENGINE": "django.db.backends.postgresql_psycopg2",
 | 
				
			||||||
@ -150,11 +162,6 @@ MEDIA_URL = "/media/"
 | 
				
			|||||||
# values in /etc/paperless.conf instead.
 | 
					# values in /etc/paperless.conf instead.
 | 
				
			||||||
# ----------------------------------------------------------------------------
 | 
					# ----------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Tap paperless.conf if it's available
 | 
					 | 
				
			||||||
if os.path.exists("/etc/paperless.conf"):
 | 
					 | 
				
			||||||
    load_dotenv("/etc/paperless.conf")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Logging
 | 
					# Logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LOGGING = {
 | 
					LOGGING = {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user