Completed
Pull Request — master (#480)
by Jace
02:01
created

main.run()   A

Complexity

Conditions 4

Size

Total Lines 14
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 13
nop 0
dl 0
loc 14
rs 9.75
c 0
b 0
f 0
1
"""Quart development server with automatic restarts."""
2
3
# pylint: disable=import-outside-toplevel,broad-except
4
5
import os
6
import time
7
import traceback
8
9
10
def run():
11
    while True:
12
        try:
13
            from memegen.settings import get_config
14
            from memegen.factory import create_app
15
            config = get_config(os.getenv('FLASK_ENV', 'local'))
16
            app = create_app(config)
17
        except Exception:
18
            traceback.print_exc()
19
            print()
20
            time.sleep(3)
21
        else:
22
            app.run(debug=True)
23
            break
24
25
26
if __name__ == "__main__":
27
    run()
28