-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
37 lines (29 loc) · 1.11 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from flask import Flask
from flask_cors import CORS
from dotenv import load_dotenv
import os
from routers import router
load_dotenv()
app= Flask(__name__)
CORS(app)
#CORS(app, resources={r"/*": {"origins": "https://contactify.codechefvit.com", "methods": ["GET", "POST"]}})
app.config['MAX_CONTENT_LENGTH'] = 1024*1024*1024
# def check_origin():
# if "Origin" not in request.headers or request.headers["Origin"] != "https://contactify.codechefvit.com":
# return False
# return True
# @app.before_request
# def before_request():
# # Check if the request origin is allowed
# if request.method != 'OPTIONS' and not check_origin():
# return jsonify({"error": "Forbidden"}), 403
app.register_blueprint(router)
# @app.errorhandler(Exception)
# def errorHandler(error):
# response = jsonify({'error': 'Server Error', 'message': str(error)})
# response.status_code = 500
# app.logger.error('Server Error: %s', error)
# app.logger.error(traceback.format_exc()) # Log the traceback
# return response
if __name__ == "__main__":
app.run(host='0.0.0.0',port=os.getenv("PORT",5000))