Flask: The file/path provided (flaskr) does not appear to exist.

Created on 15 Oct 2016  路  15Comments  路  Source: pallets/flask

The issue tracker is a tool to address bugs.
Please use the #pocoo IRC channel on freenode or Stack Overflow for questions.

~/flask-master/examples/flaskr$ flask run
Usage: flask run [OPTIONS]

Error: The file/path provided (flaskr) does not appear to exist. Please verify the path is correct. If app is not on PYTHONPATH, ensure the extension is .py

Most helpful comment

for people coming across this thread, the examples repository is located here: https://github.com/pallets/flask/tree/master/examples/flaskr. It's tested on python2 and 3, and works on both. so @cwdy yes, it's been solved. and also, just as friendly note, you might want to post/search on SO for this. see for example: http://stackoverflow.com/questions/37908358.

All 15 comments

cd .., if you have an issue with the docs please also quote the sentence that is false.

have you done the export FLASK_APP=flaskr step? following the readme in the flaskr example will tell you exact steps (if your not reading the tutorial docs)

I have a similar issues too.
I followed the readme instructions and I get the following error:

(venv) ------------------------
@flaskr:$ pip install --editable .
  ...
Successfully installed flaskr
(venv) ------------------------
@flaskr:$ export FLASK_APP=flaskr
(venv) ------------------------
@flaskr:$ flask initdb
Traceback (most recent call last):
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/bin/flask", line 11, in <module>
    sys.exit(main())
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/flask/cli.py", line 478, in main
    cli.main(args=args, prog_name=name)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/flask/cli.py", line 345, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/click/core.py", line 1055, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/click/core.py", line 1094, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/flask/cli.py", line 316, in get_command
    rv = info.load_app().cli.get_command(ctx, name)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/flask/cli.py", line 209, in load_app
    rv = locate_app(self.app_import_path)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/venv/lib/python2.7/site-packages/flask/cli.py", line 89, in locate_app
    __import__(module)
  File "/Users/Stefano/GoogleDrive/Python/Flask_examples/flaskr/flaskr/__init__.py", line 1, in <module>
    from flaskr.flaskr import app
ImportError: No module named flaskr

Also, what does edit the configuration in the flaskr.py file mean? I guess just SECRET_KEY, USERNAME and PASSWORD?

BTW, in the readme pip install --editable . is missing the space between the editable and the dot (it might sound obvious for most people, but it took me a while to figure it out and make it work since I am COMPLETELY new to Python).

Anyway, I find this Flask very instructive, as a beginner, in its minimalism!
Thanks!

I'm getting the same error in current examples/flaskr (see traceback above). This import statement: from flaskr.flaskr import app (in flaskr/__init__.py) is not working in Python 2, but does work with Python 3. The relative import works for both, from .flaskr import app. How can I get the explicit import to work for both? What's causing the problem in this case? https://github.com/pallets/flask/tree/master/examples/flaskr

I mistakenly thought the absolute import was a fix here: https://github.com/pallets/flask/issues/2051

@untitaker if you or anyone else get a chance, please take a look at this for me. in the meantime a fix would be the relative import. apologies to the author of #2051, that's what you proposed and I suggested an incorrect absolute import. i'm still puzzled why it's not working in this case.

Thanks @wgwz for the quick temporary fix!

was it solved? sorry i was python 2.7, it doesn't work wether with flaskr.flaskr or with .flaskr.

for people coming across this thread, the examples repository is located here: https://github.com/pallets/flask/tree/master/examples/flaskr. It's tested on python2 and 3, and works on both. so @cwdy yes, it's been solved. and also, just as friendly note, you might want to post/search on SO for this. see for example: http://stackoverflow.com/questions/37908358.

Thanks very much @wgwz for your answer.

Is this issue fixed or still open?

Yes it's fixed I think

okay. I want to contribute in flask. Can you recommend any other begineer level issue.

Those come to mind, although I might be underestimating the effort:

https://github.com/pallets/flask/issues/2174

https://github.com/pallets/flask/issues/1911

https://github.com/pallets/flask/issues/941

https://github.com/pallets/flask/issues/1877

There's also a lot of stuff in Werkzeug.

On Tue, Feb 28, 2017 at 12:00:04PM -0800, Sonal Arora wrote:

okay. I want to contribute in flask. Can you recommend any other begineer level issue.

--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
https://github.com/pallets/flask/issues/2058#issuecomment-283145592

kool !! Thanks :)

In my virtual envrionment and macbook, I met the same problem. it's the problem of command 'flask', my flask command is /usr/local/bin/flask (not using my virtualenv python and flask), use the command 'python -m flask run' instead 'flask run'.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wadegilmer picture wadegilmer  路  4Comments

sungjinp11 picture sungjinp11  路  3Comments

davidism picture davidism  路  3Comments

maangulo12 picture maangulo12  路  4Comments

greyli picture greyli  路  3Comments