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.

30 lines
979 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. from login import login
  6. app = Flask(__name__)
  7. api = Api(app)
  8. @app.route('/img/<path:path>')
  9. def send_img(path):
  10. return send_from_directory('images', path)
  11. if __name__ == '__main__':
  12. context = ('encryption/mycity.crt','encryption/mycity-decrypted.key')
  13. api.add_resource(voting_system.Votings, '/votings', '/votings/')
  14. api.add_resource(voting_system.Voting, '/votings/<int:voting_id>')
  15. api.add_resource(voting_system.Vote, '/vote', '/vote/')
  16. api.add_resource(rating_system.Ratings, '/ratings', '/ratings/')
  17. api.add_resource(rating_system.Rating, '/ratings/<int:rating_id>', '/ratings/<int:rating_id>/')
  18. api.add_resource(rating_system.Rate, '/rate', '/rate/')
  19. api.add_resource(login.Login, '/login', '/login/')
  20. app.run(host='0.0.0.0', port=5000, ssl_context=context)