input: Write a function to create a web API using Python and Flask to provide the current date and time. The API should have a route named '/datetime' that returns the current date and time in the format "YYYY-MM-DD HH:MM:SS". The function should also include code to run the Flask app.
output: from flask import Flask, jsonify
  from datetime import datetime
  
  app = Flask(__name__)
  
  @app.route('/datetime')
  def get_datetime():
      now = datetime.now()
      current_time = now.strftime("%Y-%m-%d %H:%M:%S")
      return jsonify({"datetime": current_time})
  
  if __name__ == '__main__':
      app.run()