mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-31 10:37:12 -04:00 
			
		
		
		
	Merge pull request #186 from rhaamo/specify_static_dir_using_conf_file
Be able to override static root using config file
This commit is contained in:
		
						commit
						ca2a556259
					
				| @ -88,6 +88,10 @@ PAPERLESS_SHARED_SECRET="" | |||||||
| # Override the default MEDIA_ROOT here.  This is where all files are stored. | # Override the default MEDIA_ROOT here.  This is where all files are stored. | ||||||
| #PAPERLESS_MEDIADIR=/path/to/media | #PAPERLESS_MEDIADIR=/path/to/media | ||||||
| 
 | 
 | ||||||
|  | # Override the default STATIC_ROOT here. This is where all static files created | ||||||
|  | # using "collectstatic" manager command are stored. | ||||||
|  | #PAPERLESS_STATICDIR="" | ||||||
|  | 
 | ||||||
| # The number of seconds that Paperless will wait between checking | # The number of seconds that Paperless will wait between checking | ||||||
| # PAPERLESS_CONSUMPTION_DIR.  If you tend to write documents to this directory | # PAPERLESS_CONSUMPTION_DIR.  If you tend to write documents to this directory | ||||||
| # very slowly, you may want to use a higher value than the default (10). | # very slowly, you may want to use a higher value than the default (10). | ||||||
|  | |||||||
| @ -49,6 +49,20 @@ def paths_check(app_configs, **kwargs): | |||||||
|                     writeable_hint.format(directory) |                     writeable_hint.format(directory) | ||||||
|                 )) |                 )) | ||||||
| 
 | 
 | ||||||
|  |     directory = os.getenv("PAPERLESS_STATICDIR") | ||||||
|  |     if directory: | ||||||
|  |         if not os.path.exists(directory): | ||||||
|  |             check_messages.append(Error( | ||||||
|  |                 exists_message.format("PAPERLESS_STATICDIR"), | ||||||
|  |                 exists_hint.format(directory) | ||||||
|  |             )) | ||||||
|  |         if not check_messages: | ||||||
|  |             if not os.access(directory, os.W_OK | os.X_OK): | ||||||
|  |                 check_messages.append(Error( | ||||||
|  |                     writeable_message.format("PAPERLESS_STATICDIR"), | ||||||
|  |                     writeable_hint.format(directory) | ||||||
|  |                 )) | ||||||
|  | 
 | ||||||
|     return check_messages |     return check_messages | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -162,7 +162,8 @@ USE_TZ = True | |||||||
| # Static files (CSS, JavaScript, Images) | # Static files (CSS, JavaScript, Images) | ||||||
| # https://docs.djangoproject.com/en/1.9/howto/static-files/ | # https://docs.djangoproject.com/en/1.9/howto/static-files/ | ||||||
| 
 | 
 | ||||||
| STATIC_ROOT = os.path.join(BASE_DIR, "..", "static") | STATIC_ROOT = os.getenv( | ||||||
|  |     "PAPERLESS_STATICDIR", os.path.join(BASE_DIR, "..", "static")) | ||||||
| MEDIA_ROOT = os.getenv( | MEDIA_ROOT = os.getenv( | ||||||
|     "PAPERLESS_MEDIADIR", os.path.join(BASE_DIR, "..", "media")) |     "PAPERLESS_MEDIADIR", os.path.join(BASE_DIR, "..", "media")) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user