[Chennaipy] [kanchilug] Re: flask error: ModuleNotFoundError: No module named 'flask.ext'

rajeshkumar p gprkumar at gmail.com
Mon Sep 12 13:18:48 EDT 2022


Hi Dhanasekar.T,

Added inline response,

On Mon, 12 Sept 2022 at 11:09, Dhanasekar <tkdhanasekar at gmail.com> wrote:

>
>
>> Try installing
>> pip install flask_routing flask_cors
>>
>
>    *# pip3 install flask_routing flask_cors *
>      requirement already satisfied
>
> Edit the lines in app.py
>> #from flask.ext.routing import router
>> #from flask.ext.cors import CORS
>> from flask_routing import router
>> from flask_cors import CORS
>>
>
>    edited the app.py file with above parameters
>    it throws views module  not found
>    and it is also installed
>     *# pip3 install views*
>
>  *# flask run --host=0.0.0.0*
> Usage: flask run [OPTIONS]
> Try 'flask run --help' for help.
>
> Error: While importing 'flask_application.app', an ImportError was raised:
>
> Traceback (most recent call last):
>   File
> "/root/flask_application/venv/lib/python3.10/site-packages/flask/cli.py",
> line 218, in locate_app
>     __import__(module_name)
>   File "/root/flask_application/app.py", line 17, in <module>
>     from views import endpoints
> *ImportError: cannot import name 'endpoints' from 'views'
> (/root/flask_application/venv/lib/python3.10/site-packages/views.py)*
>
>
Try running from the directory
$(venv)/XXXXX/books.archivelab.org/books.archivelab/

ie : $.(venv)/XXXXX/books.archivelab.org/books.archivelab/   ls
(api  app.py  configs  __init__.py  __pycache__  static  templates  views)

Try running using the command:
$.(venv)/XXXXX/books.archivelab.org/books.archivelab/python app.py

I am unable to run using flask run command.


>
> *# pip3 freeze*
> aniso8601==9.0.1
> click==8.1.3
> datatypes==0.2.6
> decorators==2.0.7
> endpoints==5.0.1
> Flask==2.2.2
> Flask-Cors==3.0.10
> Flask-Ext==0.1
> Flask-RESTful==0.3.9
> Flask-Routing==0.0.21
> itsdangerous==2.1.2
> Jinja2==3.1.2
> MarkupSafe==2.1.1
> pytz==2022.2.1
> six==1.16.0
> views==0.3
> Werkzeug==2.2.2
>
>
I can find few more extra installables in mine as below:

internetarchive==3.0.2
psycopg2-binary==2.9.3
requests==2.28.1
SQLAlchemy==1.4.41




>
> all the dependencies are installed still
> ImportError exists , any clues
> thanks for your time on this
>
>
>
> regards,
> Dhanasekar T
>

Also, Edited a file
books.archivelab/configs/__init__.py

'dbn': config.getdef('db', 'dbn', 'postgresql'),


# DATABASES
DB_URI = '%(dbn)s://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s
?client_encoding=utf8' % {
'dbn': config.getdef('db', 'dbn', 'postgresql'),


regards,
Rajeshkumar P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20220912/301bcb20/attachment.html>


More information about the Chennaipy mailing list