Locally, if I do an export FLASK_APP=index.py I get a 127.0.0.1 - - [18/Sep/2020 08:24:15] "GET / HTTP/1.1" 500 terminal message and a flask.cli.NoAppException: Could not import "index". browser message.
Works correctly for routes with an export FLASK_APP=/absolute/path/to/index.py, but again I get a FileNotFoundError: [Errno 2] No such file or directory: './data.json'. If I use an absolute path also for the data.json file, it works (locally, but, obviously, breaks the api route when deployed).
Your version works perfectly when deployed to Vercel.
Any idea about those local paths?
P.S.: Vercel build log reports Warning: Due tobuildsexisting in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Is that right?
So about the build logs I just did a test. If you remove this code below from the vercel.json file then that log goes away however the routing will not work so it is needed. It's probably just a note and not a serious warning. And you can use the command vercel --prod for production deployments that will get rid of the production log note too I updated the guide to reflect this.
I guess is not an optimal solution, but things like this are the only way that I found so far to make it work (don't mind the indentation). Quickly tested and works on Vercel too.
It seems related to how open behaves in Flask (perhaps the version I do have?). I am really curious about what can be the cause.
Ah ok that explains it. So Solus is a version of Linux? The Flask documentation only mentions Mac and Windows in the documentation as far as I can see. However you seem to have figured out how to get it working. I am sure you will figure it out as you have experience working with Solus which I have never used before.
Hello, thank you for this tutorial.
Locally, if I do an
export FLASK_APP=index.py
I get a127.0.0.1 - - [18/Sep/2020 08:24:15] "GET / HTTP/1.1" 500
terminal message and aflask.cli.NoAppException: Could not import "index".
browser message.Works correctly for routes with an
export FLASK_APP=/absolute/path/to/index.py
, but again I get aFileNotFoundError: [Errno 2] No such file or directory: './data.json'
. If I use an absolute path also for thedata.json
file, it works (locally, but, obviously, breaks the api route when deployed).Your version works perfectly when deployed to Vercel.
Any idea about those local paths?
P.S.: Vercel build log reports
Warning: Due to
buildsexisting in your configuration file, the Build and Development Settings defined in your Project Settings will not apply
. Is that right?Hi what operating system and code editor are you using? Check out the official docs here they might help flask.palletsprojects.com/en/1.1.x...
So about the build logs I just did a test. If you remove this code below from the
vercel.json
file then that log goes away however the routing will not work so it is needed. It's probably just a note and not a serious warning. And you can use the commandvercel --prod
for production deployments that will get rid of the production log note too I updated the guide to reflect this.Thank for the reply.
I use
nvim
on Solus.I did not find anything really useful in the documentation about this case, probably because it is the first time I meet Flask :)
As a temporary solution I got this:
I guess is not an optimal solution, but things like this are the only way that I found so far to make it work (don't mind the indentation). Quickly tested and works on Vercel too.
It seems related to how
open
behaves in Flask (perhaps the version I do have?). I am really curious about what can be the cause.Ah ok that explains it. So Solus is a version of Linux? The Flask documentation only mentions Mac and Windows in the documentation as far as I can see. However you seem to have figured out how to get it working. I am sure you will figure it out as you have experience working with Solus which I have never used before.
Yes, it is a Linux flavor. Thank you again for the tutorial :)