2010-04-18 19:35:40 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Patterns for Flask
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								==================
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-23 23:19:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Certain features and interactions are common enough that you will find
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								them in most web applications. For example, many applications use a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								relational database and user authentication. They will open a database
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								connection at the beginning of the request and get the information for
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								the logged in user. At the end of the request, the database connection
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								is closed.
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:35:40 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-23 23:19:40 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								These types of patterns may be a bit outside the scope of Flask itself,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								but Flask makes it easy to implement them. Some common patterns are
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								collected in the following pages.
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-03 18:22:27 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:35:40 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								.. toctree::
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   :maxdepth: 2
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   packages
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-27 23:55:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   appfactories
							 | 
						
					
						
							
								
									
										
										
										
											2011-03-15 02:19:12 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   appdispatch
							 | 
						
					
						
							
								
									
										
										
										
											2011-06-18 03:33:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   urlprocessors
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-17 07:41:57 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   distribute
							 | 
						
					
						
							
								
									
										
										
										
											2010-07-06 22:07:13 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   fabric
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:35:40 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   sqlite3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   sqlalchemy
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-25 02:36:06 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   fileuploads
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-26 00:55:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   caching
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   viewdecorators
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-19 08:22:59 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   wtforms
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:35:40 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   templateinheritance
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								   flashing
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-19 21:39:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   jquery
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-26 20:49:01 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   lazyloading
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-25 07:06:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   mongoengine
							 | 
						
					
						
							
								
									
										
										
										
											2011-01-12 17:35:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   favicon
							 | 
						
					
						
							
								
									
										
										
										
											2011-07-28 04:34:18 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   streaming
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-18 18:50:56 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   deferredcallbacks
							 | 
						
					
						
							
								
									
										
										
										
											2012-10-07 19:02:05 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   methodoverrides
							 | 
						
					
						
							
								
									
										
										
										
											2012-10-07 21:46:21 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   requestchecksum
							 | 
						
					
						
							
								
									
										
										
										
											2013-01-27 08:38:25 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   celery
							 | 
						
					
						
							
								
									
										
										
										
											2016-06-03 05:14:56 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   subclassing
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-14 05:41:48 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								   singlepageapplications
							 |