wsgi.py 979 B

12345678910111213141516171819202122232425262728293031
  1. #-*- coding:utf-8 -*-
  2. # Copyright 2017 Xiaomi, Inc.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. import os
  16. base_dir = os.path.dirname(os.path.abspath(__file__))
  17. activate_this = '%s/env/bin/activate_this.py' % base_dir
  18. try:
  19. execfile(activate_this, dict(__file__=activate_this))
  20. except:
  21. print "running without local python env"
  22. import sys
  23. sys.path.insert(0, base_dir)
  24. from rrd import app
  25. if __name__ == "__main__":
  26. app.run(host="0.0.0.0", port=8081, debug=False)