简体   繁体   中英

zappa {"message":"Forbidden"} using flask

I have a flask app that i'm able to deploy on aws using Zappa. A simple Hello World works fine but when my app redirected to a uri not including the environment name (/uri instead of /dev/uri) i get a Forbidden error.

app.route("/")
def home():
    return render_template('index.html')
    
           
@app.route("/upload", methods=['GET','POST'])
def upload():
    if request.method == "POST":
        f = request.files['file']
        f.save(os.path.join(UPLOAD_FOLDER, secure_filename(f.filename)))
        upload_file(f"uploads/{f.filename}", BUCKET)
        return redirect("/")  

The above upload method fails while accessing giving me a {"message":"Forbidden"} Error

I think it has to do something with the URI not being right because Zappa adds 'dev' path during deployment..

The developer has stated several times that a domain name is needed to overcome the addition of "/dev" and "/production". You can try following what's on this page.

GitHub issue with some response

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM