Create config file
This commit is contained in:
parent
75d11d6045
commit
adae09c3d2
2 changed files with 15 additions and 4 deletions
12
config.py
Normal file
12
config.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
config = {
|
||||
"site-name": "Quotes Database",
|
||||
"MOTD": "Welcome to the quotes database",
|
||||
"random-quote": True,
|
||||
"secret-key": "This should be a complex random value",
|
||||
"administrator-password": "This should be a different complex random value",
|
||||
}
|
||||
|
||||
# site-name will be shown in page titles and in the navbar
|
||||
# MOTD will be shown on the homepage above a random quote
|
||||
# random-quote will set whether a random quote is shown on the homepage
|
||||
# secret-key is used to protect session data from tampering
|
7
main.py
7
main.py
|
@ -1,7 +1,7 @@
|
|||
import datetime, random, json, pymongo
|
||||
from flask import Flask, render_template, Markup, request, abort, session, g
|
||||
import db
|
||||
#from smash import app, conf
|
||||
from config import config
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
@ -24,8 +24,7 @@ def message(level, msg):
|
|||
@app.route('/')
|
||||
def index():
|
||||
news = "No quotes yet!"
|
||||
#welcome = conf.config['MOTD']
|
||||
welcome = "MOTD"
|
||||
welcome = config['MOTD']
|
||||
#print(qdb.find().count())
|
||||
qCount = qdb.find({"hidden": False}).count()
|
||||
#print(type(qCount))
|
||||
|
@ -38,7 +37,7 @@ def index():
|
|||
|
||||
return render_template(
|
||||
"index.html",
|
||||
title="Quotes",
|
||||
title="Quotes" + config["site-name"],
|
||||
welcometext=welcome,
|
||||
newstext=news,
|
||||
permalink=permalink
|
||||
|
|
Loading…
Add table
Reference in a new issue