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.

35 lines
1.2 KiB

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