forked from orf/simple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_config.py
25 lines (22 loc) · 1.22 KB
/
create_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from werkzeug.security import generate_password_hash
def input_with_default(prompt, default):
x = raw_input("%s (Default %s) "%(prompt, default))
if not x:
return default
return x
with open("settings.py", "w") as fd:
print "Generating a Simple config file. Please answer some questions:"
fd.write("# -*- coding: utf-8 -*-\n\n")
fd.write("POSTS_PER_PAGE = %s\n"%input_with_default("Posts per page", 5))
fd.write("ADMIN_USERNAME = '%s'\n"%input_with_default("Admin username","admin"))
fd.write("ADMIN_PASSWORD = '%s'\n"%generate_password_hash(input_with_default("Admin password","password")) )
fd.write("ANALYTICS_ID = '%s'\n"%input_with_default("Google analytics ID",""))
fd.write('SQLALCHEMY_DATABASE_URI = "%s"\n'%input_with_default("Database URI","sqlite:///simple.db"))
fd.write("GITHUB_USERNAME = '%s'\n"%input_with_default("Github Username", ""))
fd.write("CONTACT_EMAIL = '%s'\n"%input_with_default("Contact Email", ""))
fd.write("BLOG_TITLE = '%s'\n"%input_with_default("Blog title", ""))
fd.write("BLOG_TAGLINE = '%s'\n"%input_with_default("Blog tagline", ""))
fd.write("BLOG_URL = '%s'\n"%input_with_default("Blog URL",""))
fd.flush()
print "Created!"
raw_input()