Added "runserver_profile" management command.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,3 +15,4 @@
|
|||||||
/.coverage
|
/.coverage
|
||||||
/pillar/pillar.egg-info/
|
/pillar/pillar.egg-info/
|
||||||
/pillar/google_app.json
|
/pillar/google_app.json
|
||||||
|
profile.stats
|
||||||
|
@@ -39,14 +39,15 @@ MONGO_HOST = os.environ.get('MONGO_HOST', 'localhost')
|
|||||||
|
|
||||||
|
|
||||||
@manager.command
|
@manager.command
|
||||||
def runserver():
|
def runserver(**options):
|
||||||
# Automatic creation of STORAGE_DIR path if it's missing
|
# Automatic creation of STORAGE_DIR path if it's missing
|
||||||
if not os.path.exists(app.config['STORAGE_DIR']):
|
if not os.path.exists(app.config['STORAGE_DIR']):
|
||||||
os.makedirs(app.config['STORAGE_DIR'])
|
os.makedirs(app.config['STORAGE_DIR'])
|
||||||
|
|
||||||
app.run(host=app.config['HOST'],
|
app.run(host=app.config['HOST'],
|
||||||
port=app.config['PORT'],
|
port=app.config['PORT'],
|
||||||
debug=app.config['DEBUG'])
|
debug=app.config['DEBUG'],
|
||||||
|
**options)
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
@manager.command
|
||||||
@@ -60,6 +61,13 @@ def runserver_memlimit(limit_kb=1000000):
|
|||||||
runserver()
|
runserver()
|
||||||
|
|
||||||
|
|
||||||
|
@manager.command
|
||||||
|
def runserver_profile(pfile='profile.stats'):
|
||||||
|
import cProfile
|
||||||
|
|
||||||
|
cProfile.run('runserver(use_reloader=False)', pfile)
|
||||||
|
|
||||||
|
|
||||||
def post_item(entry, data):
|
def post_item(entry, data):
|
||||||
return post_internal(entry, data)
|
return post_internal(entry, data)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user