# .env fix
* adds celery setting to .env.sample
This commit is contained in:
		
							parent
							
								
									801c9078e9
								
							
						
					
					
						commit
						dc754c0363
					
				@ -12,6 +12,10 @@ DB_NAME=konova
 | 
				
			|||||||
DB_HOST=127.0.0.1
 | 
					DB_HOST=127.0.0.1
 | 
				
			||||||
DB_PORT=5432
 | 
					DB_PORT=5432
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Redis (for celery)
 | 
				
			||||||
 | 
					REDIS_HOST=CHANGE_ME
 | 
				
			||||||
 | 
					REDIS_PORT=CHANGE_ME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# E-Mail
 | 
					# E-Mail
 | 
				
			||||||
SMTP_HOST=localhost
 | 
					SMTP_HOST=localhost
 | 
				
			||||||
SMTP_PORT=25
 | 
					SMTP_PORT=25
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from celery import Celery
 | 
					from celery import Celery
 | 
				
			||||||
 | 
					from konova.sub_settings.django_settings import env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set the default Django settings module for the 'celery' program.
 | 
					# Set the default Django settings module for the 'celery' program.
 | 
				
			||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'konova.settings')
 | 
					os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'konova.settings')
 | 
				
			||||||
@ -17,7 +18,7 @@ app.config_from_object('django.conf:settings', namespace='CELERY')
 | 
				
			|||||||
app.autodiscover_tasks()
 | 
					app.autodiscover_tasks()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Declare redis as broker
 | 
					# Declare redis as broker
 | 
				
			||||||
app.conf.broker_url = 'redis://localhost:6379/0'
 | 
					app.conf.broker_url = f'redis://{env("REDIS_HOST")}:{env.int("REDIS_PORT")}/0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@app.task(bind=True)
 | 
					@app.task(bind=True)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user