暫無描述

app.py 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from flask import Flask, request, redirect, url_for, render_template
  2. #from flask.ext.pymongo import PyMongo
  3. from assets import create_assets
  4. import os
  5. class CustomFlask(Flask):
  6. jinja_options = Flask.jinja_options.copy()
  7. jinja_options.update(dict(
  8. variable_start_string='%%',
  9. variable_end_string='%%',
  10. ))
  11. app = CustomFlask(__name__)
  12. app.config['DEBUG'] = True
  13. '''app.config['MONGO_DBNAME'] = 'tumcomm_db'
  14. #app.config['MONGO_HOST'] = '61.19.226.195'
  15. if os.environ.get('LIVELY_ENV') == 'prod':
  16. DB_HOST = os.environ.get('DB_HOST', '10.0.3.6')
  17. app.config['MONGO_HOST'] = DB_HOST
  18. app.config['UPLOAD_FOLDER'] = '/opt/media'
  19. app.config['IMG_SV'] = "http://mcot-images.simplico.net"
  20. app.config['VOD_SV'] = "http://61.19.226.179:1935/vod/_definst_/mp4:media01/"
  21. app.config['ENV'] = 'prod'
  22. else:
  23. app.config['MONGO_HOST'] = 'localhost'
  24. app.config['UPLOAD_FOLDER'] = '/opt/media'
  25. app.config['IMG_SV'] = "http://mcot-images.simplico.net"
  26. app.config['VOD_SV'] = "http://61.19.226.179:1935/vod/_definst_/mp4:media01/"
  27. app.config['MONGO_CONNECT'] = False
  28. #mongo = PyMongo(app)
  29. '''
  30. create_assets(app)
  31. @app.route('/', defaults={'path': ''})
  32. @app.route('/<path:path>')
  33. def index(path):
  34. return render_template('index.html')
  35. #@app.route('/content')
  36. #def content():
  37. # return render_template('content.html')
  38. if __name__ == '__main__':
  39. app.debug = app.config['DEBUG']
  40. app.run()