forked from jeffknupp/bull
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbull
More file actions
executable file
·73 lines (56 loc) · 1.7 KB
/
bull
File metadata and controls
executable file
·73 lines (56 loc) · 1.7 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
"""Bull environment setup script."""
import argparse
import os
import sys
APP_CODE = """
from bull import app, db
def get_app():
return app
if __name__ == '__main__':
app.config.from_object('config')
with app.app_context():
db.metadata.create_all(bind=db.engine)
get_app().run(debug=True)
"""
CONFIG_CODE = """
from os.path import abspath, dirname, join
_cwd = dirname(abspath(__file__))
# Subject of the email sent after purchase
# MAIL_SUBJECT =
# Email address for the 'from' field of the generated email
# MAIL_FROM =
# Email server address
# MAIL_SERVER =
# Email server username
# MAIL_USERNAME =
# Email server password
# MAIL_PASSWORD =
# Email server port
# MAIL_PORT =
# Use SSL for email?
# MAIL_USE_SSL =
# Website address, for use in Stripe purchases and in email
# SITE_ADDRESS =
# Database URI for SQLAlchmey (Default: 'sqlite+pysqlite3:///sqlite3.db')
# SQLALCHEMY_DATABASE_URI = 'sqlite+pysqlite:///sqlite3.db'
# Stripe secret key to be used to process purchases
STRIPE_SECRET_KEY = ''
# Stripe public key to be used to process purchases
STRIPE_PUBLIC_KEY = ''
"""
def main(args):
"""Main entry point for script."""
if args.environment:
os.mkdir(args.environment)
os.chdir(args.environment)
with open('app.py', 'w') as output:
output.write(APP_CODE)
with open('config.py', 'w') as output:
output.write(CONFIG_CODE)
os.mkdir('files')
print 'Environment created!'
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('environment', help='directory in which a new bull installation should be setup')
sys.exit(main(parser.parse_args()))