Added runserver_memlimit management command.

This commit is contained in:
2016-05-17 13:41:07 +02:00
parent b556caf8dd
commit 277e82c8e6

View File

@@ -49,6 +49,17 @@ def runserver():
debug=app.config['DEBUG']) debug=app.config['DEBUG'])
@manager.command
def runserver_memlimit(limit_kb=1000000):
import resource
limit_b = int(limit_kb) * 1024
for rsrc in (resource.RLIMIT_AS, resource.RLIMIT_DATA, resource.RLIMIT_RSS):
resource.setrlimit(rsrc, (limit_b, limit_b))
runserver()
def post_item(entry, data): def post_item(entry, data):
return post_internal(entry, data) return post_internal(entry, data)