helloflask / helloflask/flask-dropzone
Template not rendered
- Dominant language
- Python
- Stars
- 246
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I tried to make single-page app with dropzone but my template is not rendered. Without dropzone, it works, so I believe I miss configurations. Here is simplified example:
**app.py**:
```py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import pathlib
from flask import Flask, render_template, request
from flask_dropzone import Dropzone
app = Flask(__name__)
basedir = pathlib.Path(__file__).parent
app.config.update(
UPLOADED_PATH=pathlib.Path(basedir, "uploads"),
)
dropzone = Dropzone(app)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/", methods=["POST", "GET"])
def upload():
if request.method == "POST":
f = request.files.get("file")
if f.filename != "":
f.save(pathlib.Path(app.config["UPLOADED_PATH"], f.filename))
result = f"{f.filename} uploaded!"
print(result)
return render_template("result.html", message=result)
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
```
**index.html**:
```html
Flask-Dropzone Demo
{{ dropzone.load_css() }}
{{ dropzone.style('border: 2px dashed #0087F7; margin: 10%; min-height: 400px;') }}
{{ dropzone.create('upload') }}
{% block content %}{% endblock %}
{{ dropzone.load_js() }}
{{ dropzone.config() }}
```
**result.html**:
```html
{% extends "index.html" %}
{% block content %}
Result
{{ message }}
{% endblock %}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.