Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file/path provided (flaskr) does not appear to exist. #2058

Closed
tuhaolam opened this issue Oct 15, 2016 · 15 comments
Closed

The file/path provided (flaskr) does not appear to exist. #2058

tuhaolam opened this issue Oct 15, 2016 · 15 comments

Comments

@tuhaolam
Copy link

tuhaolam commented Oct 15, 2016

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

@untitaker
Copy link
Contributor

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

@wgwz
Copy link
Contributor

wgwz commented Oct 15, 2016

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)

@stebogit
Copy link

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!

@wgwz
Copy link
Contributor

wgwz commented Oct 24, 2016

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: #2051

@wgwz
Copy link
Contributor

wgwz commented Oct 26, 2016

@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.

@stebogit
Copy link

Thanks @wgwz for the quick temporary fix!

@cwdy
Copy link

cwdy commented Jan 11, 2017

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

@wgwz
Copy link
Contributor

wgwz commented Jan 11, 2017

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.

@cwdy
Copy link

cwdy commented Jan 12, 2017

Thanks very much @wgwz for your answer.

@SonaArora
Copy link

Is this issue fixed or still open?

@untitaker
Copy link
Contributor

Yes it's fixed I think

@SonaArora
Copy link

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

@untitaker
Copy link
Contributor

untitaker commented Feb 28, 2017 via email

@SonaArora
Copy link

kool !! Thanks :)

@xuzhouchuan
Copy link

xuzhouchuan commented Mar 1, 2018

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'.

@pallets pallets locked and limited conversation to collaborators Mar 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants