liqian пре 3 година
родитељ
комит
4ca6724d67
1 измењених фајлова са 11 додато и 4 уклоњено
  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()