Add basic Flask/Jinja setup and basic YAML config
This commit is contained in:
parent
c2d8d5af22
commit
657ee72ecb
4 changed files with 64 additions and 0 deletions
28
liteshort.py
Normal file
28
liteshort.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
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()
|
Reference in a new issue