'Digitalocean Apps platform run time error - "workspace" directory is getting added
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"
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mandar |