| 
									
										
										
										
											2024-12-18 09:05:31 +08:00
										 |  |  | from libs import version_utils | 
					
						
							| 
									
										
										
										
											2024-04-18 20:24:05 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-30 23:05:22 +08:00
										 |  |  | # preparation before creating app | 
					
						
							|  |  |  | version_utils.check_supported_python_version() | 
					
						
							| 
									
										
										
										
											2024-12-18 09:05:31 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def is_db_command(): | 
					
						
							|  |  |  |     import sys | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db": | 
					
						
							|  |  |  |         return True | 
					
						
							|  |  |  |     return False | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # create app | 
					
						
							| 
									
										
										
										
											2024-12-18 09:05:31 +08:00
										 |  |  | if is_db_command(): | 
					
						
							|  |  |  |     from app_factory import create_migrations_app | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = create_migrations_app() | 
					
						
							|  |  |  | else: | 
					
						
							|  |  |  |     from app_factory import create_app | 
					
						
							|  |  |  |     from libs import threadings_utils | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     threadings_utils.apply_gevent_threading_patch() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = create_app() | 
					
						
							|  |  |  |     celery = app.extensions["celery"] | 
					
						
							| 
									
										
										
										
											2023-05-15 08:51:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-15 12:54:05 +08:00
										 |  |  | if __name__ == "__main__": | 
					
						
							|  |  |  |     app.run(host="0.0.0.0", port=5001) |