Digitalocean Apps平台运行时间错误 - “工作区”目录正在添加
我可以在Digitalocean的应用程序平台上成功部署Python/Blask应用程序。
现在,它给出运行时错误
应用程序运行时日志错误:filenotfounderror:[errno 2]没有这样的文件或目录:'/ workspace /static/static/static/flora_title/anacardiaceae_buchanania cochinchineensis_1_title1.jpg'
因此看起来像“ workpace”,目录已添加到我的HTML静态数据路径中,这是我不希望的。这导致我所有的静态文件路径简直无法访问。
想知道这里的解决方案是什么?这是我第一次在Do Apps平台中部署应用程序。
如下:
[OneFlorAcdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [IFEF]启动Gunicorn 20.1.0 [OneFlorAcdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [1] [INFO]在: http://0.0.0.0:8080 (1) [Onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [1] [信息]使用工人:Sync [Onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [16] [16] [INFO] PID启动工人:16 [Onefloracdn] [2022-05-03 17:21:01] OpenBlas警告 - 无法确定该系统上的L2高速缓存尺寸,假设有256K [Onefloracdn] [2022-05-03 17:21:30] [2022-05-03 17:21:30,414] APP中的错误:异常 / [GET] [Onefloracdn] [2022-05-03 17:21:30] Trackback(最新通话上次): [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/app.py.py”,第2077行,第2077行, [Onefloracdn] [2022-05-03 17:21:30]响应= self.full_dispatch_request() [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/app.py”,第1525行,infull_dispatch_request [Onefloracdn] [2022-05-03 17:21:30] RV = self.handle_user_exception(e) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/app.py”,第1523行,inful_dispatch_request [Onefloracdn] [2022-05-03 17:21:30] rv = self.dispatch_request() [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/app.py”,第1509行,In dispatch_request [onefloracdn] [2022-05-03 17:21:30]返回self.ensure_sync(self.view_functions [rule.endpoint])(** req.view_args) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/species_visualization.py”,第37行,在索引中 [onefloracdn] [2022-05-03 17:21:30]返回render_template(“ homepage.html”,all_speciesj = alls_speciesj) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/templating.py.py.py”,第148行 [onefloracdn] [2022-05-03 17:21:30]返回_render( [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask/templating.py.py.py”,第128行, [Onefloracdn] [2022-05-03 17:21:30] RV = Template.Render(context) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/jinja2/jinja2/environment.py”,第1291行, [onefloracdn] [2022-05-03 17:21:30] self.environment.handle_exception() [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/jinja2/jinja2/environment.py”,第926行, [Onefloracdn] [2022-05-03 17:21:30]提高REWRITE_TRACEBACK_STACK(source = source) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/templates/homepage.html”,第80行,在顶级模板代码中 [Onefloracdn] [2022-05-03 17:21:30] [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/lib/python3.10/site-packages/flask_cdn.py”,第54行,在url_for中 [Onefloracdn] [2022-05-03 17:21:30]值['t'] = int(os.path.getmtime(path)) [onefloracdn] [2022-05-03 17:21:30]文件“/workspace/.heroku/python/lib/python3.10/genericpath.py.py”,第55行,在GetMtime中 [onefloracdn] [2022-05-03 17:21:30]返回os.stat(fileName).ST_MTIME
[Onefloracdn] [2022-05-03-03 17:21:21:30]文件或目录:'/workspace/static/flora_title/anacardiaceae_buchanania cochinchinensis_1_title1.jpg'
[onefloracdn] [2022-05-03-03 17:21:30:21:30] 21:30 +0000]“ get/http/1.1” 500 290“ - ”“ mozilla/5.0(Windows NT 10.0; Win64; win64; x64)Applewebkit/537.36(Khtml,像Gecko一样,像Gecko)Chrome/101.0.0.0.4951.41 Safari/536 Safari/536 Edg/Edg/ 101.0.1210.32“
I could successfully deploy python/flask app on Digitalocean's Apps Platform.
Now its giving runtime error
app runtime log error: FileNotFoundError: [Errno 2] No such file or directory: ‘/workspace/static/flora_title/Anacardiaceae_Buchanania cochinchinensis_1_Title1.JPG’
so it looks like the “workspace” directory is getting added to my html static data paths, which i don’t expect. This is causing all my static file paths simply inaccessible.
Wondering what could be the solution here? this is first time I am deploying app in DO Apps platform.
Runtime Log as below:
[onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [INFO] Starting gunicorn 20.1.0
[onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [1] [INFO] Using worker: sync
[onefloracdn] [2022-05-03 17:21:01] [2022-05-03 17:21:01 +0000] [16] [INFO] Booting worker with pid: 16
[onefloracdn] [2022-05-03 17:21:01] OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k
[onefloracdn] [2022-05-03 17:21:30] [2022-05-03 17:21:30,414] ERROR in app: Exception on / [GET]
[onefloracdn] [2022-05-03 17:21:30] Traceback (most recent call last):
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/app.py", line 2077, in wsgi_app
[onefloracdn] [2022-05-03 17:21:30] response = self.full_dispatch_request()
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/app.py", line 1525, in full_dispatch_request
[onefloracdn] [2022-05-03 17:21:30] rv = self.handle_user_exception(e)
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/app.py", line 1523, in full_dispatch_request
[onefloracdn] [2022-05-03 17:21:30] rv = self.dispatch_request()
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/app.py", line 1509, in dispatch_request
[onefloracdn] [2022-05-03 17:21:30] return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/species_visualization.py", line 37, in index
[onefloracdn] [2022-05-03 17:21:30] return render_template("HomePage.html", all_speciesj = all_speciesj)
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/templating.py", line 148, in render_template
[onefloracdn] [2022-05-03 17:21:30] return _render(
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask/templating.py", line 128, in _render
[onefloracdn] [2022-05-03 17:21:30] rv = template.render(context)
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/jinja2/environment.py", line 1291, in render
[onefloracdn] [2022-05-03 17:21:30] self.environment.handle_exception()
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/jinja2/environment.py", line 926, in handle_exception
[onefloracdn] [2022-05-03 17:21:30] raise rewrite_traceback_stack(source=source)
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/templates/HomePage.html", line 80, in top-level template code
[onefloracdn] [2022-05-03 17:21:30]
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/site-packages/flask_cdn.py", line 54, in url_for
[onefloracdn] [2022-05-03 17:21:30] values['t'] = int(os.path.getmtime(path))
[onefloracdn] [2022-05-03 17:21:30] File "/workspace/.heroku/python/lib/python3.10/genericpath.py", line 55, in getmtime
[onefloracdn] [2022-05-03 17:21:30] return os.stat(filename).st_mtime
[onefloracdn] [2022-05-03 17:21:30] FileNotFoundError: [Errno 2] No such file or directory: '/workspace/static/flora_title/Anacardiaceae_Buchanania cochinchinensis_1_Title1.JPG'
[onefloracdn] [2022-05-03 17:21:30] 10.244.35.126 - - [03/May/2022:17:21:30 +0000] "GET / HTTP/1.1" 500 290 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 Edg/101.0.1210.32"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
原来是一个愚蠢的问题的另一个“宝石”。会回答自己..
我没有将静态文件放在App的平台中...简单
Turns out to be another 'gem' of a stupid question..but thats ok. Will answer myself..
I did not put my static files in App's platform...simple
对于任何正在遇到Digitalocean App Platform和Flask问题的人来说……我花了几天时间才能弄清楚这一切并进行故障排除。
因此,为了节省一些时间,我创建了一个启动器项目模板,其中包含有关如何使用PostgreSQL设置获得烧瓶应用程序的说明,并为App Platform运行的任何人都有兴趣。
这是开始启动项目的链接: https://github.com/github.com/github.com/heyaustinwood/flask-flask--flask--flask--flask--flask-wood- do-app-platform
For anyone else that is running into issues with DigitalOcean app platform and Flask... it took me a couple of days to figure it all out and troubleshoot.
So, to save you some time, I created a starter project template with instructions on how to get a Flask app with postgresql setup and running for the app platform for anyone that is interested.
Here's a link to the starter project: https://github.com/heyaustinwood/flask-do-app-platform