froala / froala/wysiwyg-editor-python-sdk

upload image cannot be loaded from passed link in python sdk for flask

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1
Forks
0
Avg merge
31m
Merged PRs (30d)
1

Description

Hi, I am using froala's python sdk for my flask app. It uploads the image successfully but can't load the image.
Here is my code:
```
@app.route('/upload_image', methods=['POST','GET'])
def upload_image():
try:
response = Image.upload(FlaskAdapter(request), '\\public\\')
except Exception:
response = {'error': str(sys.exc_info()[1])}
return json.dumps(response)

@app.route('/load')
def load():
try:
response = Image.list('public/')
except:
response = {'error': str(sys.exc_info()[1])}
return json.dumps(response)

```

Here is the html code:
```







new FroalaEditor('.selector', {
// Set the image upload URL.
imageUploadURL: '/upload_image',
imageManagerLoadUrl:'/load',
})


```
The image says 404 while loading:
```
127.0.0.1 - - [21/Apr/2021 10:28:35] "POST /upload_image HTTP/1.1" 200 -
127.0.0.1 - - [21/Apr/2021 10:28:35] "GET /public/1a7a6e5e85028030c2e9457532bc691bc5843701.jpg HTTP/1.1" 404 -
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.