import logging
import os

from flask import Flask, request
from gcloud import storage
app = Flask(__name__)
app.config['DEBUG'] = True

# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.

# Configure this environment variable via app.yaml
RENDER_STATIC_FOLDER_NAME = "static\/render-img\/"
CLOUD_STORAGE_BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
# [end config]

@app.route('/')
#def hello():
#    """Return a friendly HTTP greeting."""
def index():
    return """
    Upload Image <br>
<form method="POST" action="/upload" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit">
</form>
"""

@app.route('/upload', methods=['POST'])
def upload():
    """Process the uploaded file and upload it to Google Cloud Storage."""
    uploaded_file = request.files.get('file')

    if not uploaded_file:
        return 'No file uploaded.', 400

    # Create a Cloud Storage client.
    gcs = storage.Client()

    # Get the bucket that the file will be uploaded to.
    bucket = gcs.get_bucket(CLOUD_STORAGE_BUCKET)

    # Create a new blob and upload the file's content.
    blob = bucket.blob(RENDER_STATIC_FOLDER_NAME + uploaded_file.filename)

    blob.upload_from_string(
        uploaded_file.read(),
        content_type=uploaded_file.content_type
    )

    # The public URL can be used to directly access the uploaded file via HTTP.
    #return blob.public_url
    return redirect(url_for('index'))

@app.errorhandler(500)
def server_error(e):
    logging.exception('An error occurred during a request.')
    return """
    An internal error occurred: <pre>{}</pre>
    See logs for full stacktrace.
    """.format(e), 500

@app.errorhandler(404)
def page_not_found(e):
    """Return a custom 404 error."""
    return 'Sorry, nothing at this URL.', 404

@@ -335,17 +335,16 @@
  %22static
-%5C
 /render-
@@ -350,9 +350,8 @@
 -img
-%5C
 /%22%0AC
@@ -1487,21 +1487,17 @@
 rl_for('
-index
+/
 '))%0A%0A@ap

update main.py