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