mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Merge pull request #156 from avichalp/gunicorn-conf
Add gunicorn configuration file
This commit is contained in:
		
						commit
						b66ec6ba27
					
				@ -12,3 +12,4 @@ python-dateutil>=2.4.2
 | 
			
		||||
python-dotenv>=0.3.0
 | 
			
		||||
python-gnupg>=0.3.8
 | 
			
		||||
pytz>=2015.7
 | 
			
		||||
gunicorn==19.6.0
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										48
									
								
								scripts/gunicorn.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								scripts/gunicorn.conf
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
bind = '127.0.0.1:8000'
 | 
			
		||||
backlog = 2048
 | 
			
		||||
workers = 1
 | 
			
		||||
worker_class = 'sync'
 | 
			
		||||
worker_connections = 1000
 | 
			
		||||
timeout = 20
 | 
			
		||||
keepalive = 2
 | 
			
		||||
spew = False
 | 
			
		||||
daemon = False
 | 
			
		||||
pidfile = None
 | 
			
		||||
umask = 0
 | 
			
		||||
user = None
 | 
			
		||||
group = None
 | 
			
		||||
tmp_upload_dir = None
 | 
			
		||||
loglevel = 'info'
 | 
			
		||||
errorlog = '-'
 | 
			
		||||
accesslog = '-'
 | 
			
		||||
proc_name = None
 | 
			
		||||
 | 
			
		||||
def pre_fork(server, worker):
 | 
			
		||||
    pass
 | 
			
		||||
 | 
			
		||||
def pre_exec(server):
 | 
			
		||||
    server.log.info("Forked child, re-executing.")
 | 
			
		||||
 | 
			
		||||
def when_ready(server):
 | 
			
		||||
    server.log.info("Server is ready. Spawning workers")
 | 
			
		||||
 | 
			
		||||
def worker_int(worker):
 | 
			
		||||
    worker.log.info("worker received INT or QUIT signal")
 | 
			
		||||
 | 
			
		||||
    ## get traceback info
 | 
			
		||||
    import threading, sys, traceback
 | 
			
		||||
    id2name = dict([(th.ident, th.name) for th in threading.enumerate()])
 | 
			
		||||
    code = []
 | 
			
		||||
    for threadId, stack in sys._current_frames().items():
 | 
			
		||||
        code.append("\n# Thread: %s(%d)" % (id2name.get(threadId,""),
 | 
			
		||||
            threadId))
 | 
			
		||||
        for filename, lineno, name, line in traceback.extract_stack(stack):
 | 
			
		||||
            code.append('File: "%s", line %d, in %s' % (filename,
 | 
			
		||||
                lineno, name))
 | 
			
		||||
            if line:
 | 
			
		||||
                code.append("  %s" % (line.strip()))
 | 
			
		||||
    worker.log.debug("\n".join(code))
 | 
			
		||||
 | 
			
		||||
def worker_abort(worker):
 | 
			
		||||
    worker.log.info("worker received SIGABRT signal")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user