liqian il y a 3 ans
Parent
commit
4ca6724d67
1 fichiers modifiés avec 11 ajouts et 4 suppressions
  1. 11 4
      config.py

+ 11 - 4
config.py

@@ -256,7 +256,14 @@ class ProductionConfig(BaseConfig):
 
 
 def set_config():
-    # return DevelopmentConfig()
-    # return TestConfig()
-    # return PreProductionConfig()
-    return ProductionConfig()
+    with open('env.conf', 'r') as env_f:
+        line = env_f.read()
+        env = line.split('=')[1].strip()
+    if env == 'dev':
+        return DevelopmentConfig()
+    elif env == 'test':
+        return TestConfig()
+    elif env == 'pre':
+        return PreProductionConfig()
+    elif env == 'pro':
+        return ProductionConfig()