Skip to content

Commit

Permalink
Trying cors new origin
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamgutgutia committed Dec 17, 2023
1 parent 750ad73 commit 1a94416
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
load_dotenv()

app= Flask(__name__)
CORS(app)
#CORS(app, resources={r"/*": {"origins": "https://contactify.codechefvit.com", "methods": ["GET", "POST"]}})
#CORS(app)
CORS(app, resources={r"/*": {"origins": "https://www.google.com", "methods": ["GET", "POST"]}})
app.config['MAX_CONTENT_LENGTH'] = 1024*1024*1024

@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


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))

0 comments on commit 1a94416

Please sign in to comment.