mirror of
https://git.ikl.sh/132ikl/liteshort.git
synced 2023-08-10 21:13:04 +03:00
29 lines
641 B
Python
29 lines
641 B
Python
from flask import Flask
|
|
import yaml
|
|
|
|
|
|
def load_config():
|
|
new_config = yaml.load(open("config.yml"))
|
|
if "admin_hashed_password" in new_config.keys():
|
|
new_config["password"] = new_config["admin_hashed_password"]
|
|
elif "admin_password" in new_config.keys():
|
|
new_config["password"] = new_config["admin_password"]
|
|
else:
|
|
raise Exception("admin_password or admin_hashed_password must be set in config.yml")
|
|
return new_config
|
|
|
|
|
|
config = load_config()
|
|
print(config["password"])
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
@app.route('/')
|
|
def hello_world():
|
|
return 'Hello World!'
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run()
|