You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
800 B

  1. from flask import Flask, send_from_directory
  2. from flask_restful import Resource, Api
  3. from voting_system import voting_system
  4. from rating_system import rating_system
  5. app = Flask(__name__)
  6. api = Api(app)
  7. @app.route('/img/<path:path>')
  8. def send_img(path):
  9. return send_from_directory('images', path)
  10. if __name__ == '__main__':
  11. api.add_resource(voting_system.Votings, '/votings', '/votings/')
  12. api.add_resource(voting_system.Voting, '/votings/<int:voting_id>')
  13. api.add_resource(voting_system.Vote, '/vote', '/vote/')
  14. api.add_resource(rating_system.Ratings, '/ratings', '/ratings/')
  15. api.add_resource(rating_system.Rating, '/ratings/<int:rating_id>', '/ratings/<int:rating_id>/')
  16. api.add_resource(rating_system.Rate, '/rate', '/rate/')
  17. app.run(host='0.0.0.0', port=5000)