Topic: why component can\’t show normally in the flask backend?
Zhe Lee pro asked 7 years ago
here is my html code I just replace the static file css, image, etc with url_for function, http://7xpvdr.com1.z0.glb.clouddn.com/index_template.html But the component is shown like this. Why is this?http://7xpvdr.com1.z0.glb.clouddn.com/0130131551.png
here is the difference, the image up is holded by flask, and image below is double click from the explorer, here is the thing.
![20180130163514](http://7xpvdr.com1.z0.glb.clouddn.com/0130163432.png)
Jakub Strebeyko staff answered 6 years ago
div class="btn btn-primary btn-sm"
or the span
within.
I wasn't able to recreate the issue on a Flask server - running it renders the same as just starting it from the html template. I wish I could be more helpful. It seems that you might be the only one who can figure out what causes this trouble, as the additional characters are not found within the sent file structure (as no code there contains the string "文件").
With Best Regards,
Kuba
Jakub Strebeyko staff answered 7 years ago
Zhe Lee pro commented 7 years ago
OMG, I run the free template works fine on flask, but some pro components don't. So I buy the pro version for this reason. Any workaround bro. Or which web server can be used for your template. Thanks in advance.Jakub Strebeyko staff commented 6 years ago
Hi Zhe Lee, Any web server can be used to host our products. The problem you are facing stems out of a faulty implementation method. Please share your code and file structure and perhaps we will be able to figure out what causes the issue. With Best Regards, KubaZhe Lee pro commented 6 years ago
hi bro please check my code here. if you just run the html file. it works fine, but if you run it buy run the flask server. python.exe render_template_main.py and then open url 127.0.0.1 the choose file box show out error. http://7xpvdr.com1.z0.glb.clouddn.com/error.zipJakub Strebeyko staff commented 6 years ago
Hi there Zhe Lee, 恐怕是你的程序错误. Running html file goes without problems, except you got the scripts' relative paths wrong (instead ofjs/mdb.min.js
it should be ../static/js/mdb.min.js
). Besides that, running the .py
file throws back an error: File "render_template_main.py", line 3, in ImportError: No module named _thread
. I'm afraid I cannot be helpful in that one.
春节快乐,
Kuba
Zhe Lee pro commented 6 years ago
Hi there, the error you got is because your python lack of the package I think. please try this code, I delete the nessecery packages import, maybe this one can works on you. http://7xpvdr.com1.z0.glb.clouddn.com/render_template_main.pyZhe Lee pro commented 6 years ago
And I think the relative path not effect the result. I change the relatetive path of the js. But it still happens.Jakub Strebeyko staff commented 6 years ago
Hi Zhe Lee, Thanks for editing the.py
file and getting rid of the dependencies. I followed your instructions, even installed Flask, but then the fuzzyfinder
is the issue, while the repo is dead. Please try to provide a working reproduction of the error online.
Best,
Kuba
Zhe Lee pro commented 6 years ago
thanks a lot for your reply. bro. Just delete that line will be ok. I forgot to delete it at first . so sorry. So the final code is : # -*- coding: utf-8 -*- from flask import Flask, render_template, request, jsonify, url_for, redirect app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') if __name__ == "__main__": host = '127.0.0.1' port = 5000 app.run(debug = True, host = host, port = port)Zhe Lee pro commented 6 years ago
visit this url, and you will see the choose file component show like this : http://7xpvdr.com1.z0.glb.clouddn.com/0202203506.pngZhe Lee pro commented 6 years ago
the indent not correct in the post. please use this file, this is correct. http://7xpvdr.com1.z0.glb.clouddn.com/render_template_main_2.pyFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Zhe Lee pro commented 7 years ago
I copy all the related files to the flask static folder but don't work. http://7xpvdr.com1.z0.glb.clouddn.com/0130131935.pngZhe Lee pro commented 7 years ago
Even I remove the url_for function the components won't work either http://7xpvdr.com1.z0.glb.clouddn.com/0130135321.pngZhe Lee pro commented 7 years ago
If the html is run from the explorer just double click is enough but if you want to run it from flask the component can't show correct. ~~ Terrible things.