Add clear_cache cli command. fix #98
This commit is contained in:
		
							parent
							
								
									9643f79de3
								
							
						
					
					
						commit
						98c3839168
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		|  | @ -1,4 +1,4 @@ | ||||||
| from realms import config, create_app, db, __version__, flask_cli as cli | from realms import config, create_app, db, __version__, flask_cli as cli, cache | ||||||
| from realms.lib.util import random_string, in_virtualenv, green, yellow, red | from realms.lib.util import random_string, in_virtualenv, green, yellow, red | ||||||
| from subprocess import call, Popen | from subprocess import call, Popen | ||||||
| from multiprocessing import cpu_count | from multiprocessing import cpu_count | ||||||
|  | @ -407,6 +407,15 @@ def drop_db(): | ||||||
|         db.metadata.drop_all(db.get_engine(app)) |         db.metadata.drop_all(db.get_engine(app)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @cli.command() | ||||||
|  | def clear_cache(): | ||||||
|  |     """ Clears cache | ||||||
|  |     """ | ||||||
|  |     yellow("Clearing the cache") | ||||||
|  |     with app.app_context(): | ||||||
|  |         cache.clear() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @cli.command() | @cli.command() | ||||||
| def test(): | def test(): | ||||||
|     """ Run tests |     """ Run tests | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue