17 lines
		
	
	
		
			452 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			452 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from peewee import PostgresqlDatabase
 | |
| import configparser
 | |
| 
 | |
| main_config = configparser.ConfigParser()
 | |
| main_config.read("/app/containerdata/config/news_fetch.config.ini")
 | |
| 
 | |
| db_config = configparser.ConfigParser()
 | |
| db_config.read("/app/containerdata/config/db.config.ini")
 | |
| 
 | |
| cred = db_config["DATABASE"]
 | |
| db = PostgresqlDatabase(
 | |
|     cred["db_name"], user=cred["user_name"], password=cred["password"], host="vpn", port=5432
 | |
| )
 | |
| 
 | |
| import models
 | |
| models.set_db(db)
 |