i just moved from bottleframework to flask. I changes what needed to be altered to convert the code and when i run it i just get "Internal server error" Running tail -f ../logs/error_log i get no errors. How can i find out what is the culprit her
vergos....@gmail.com
vergos.nikolas at gmail.com
Thu Jul 8 12:29:49 EDT 2021
Στις Πέμπτη, 8 Ιουλίου 2021 στις 7:16:27 μ.μ. UTC+3, ο χρήστης Stestagg έγραψε:
> [my reply on the list this time :)]
>
> That's fine. Sorry, I should have provided more information.
>
> This type of error that you're gettting /can/ happen if you have the
> library correctly installed, but within your project, you have a different
> file of the same name as the library.
> Then when python tries to import 'flask', it actually imports your local
> file, NOT the installed flask.
>
> You see the error message is *not* saying that python can't find flask, but
> that it can't find a name `run` within the flask module:
> from flask import run, route, request, redirect
> ImportError: cannot import name 'run'
> Therefore python has successfully found a module named flask somewhere,
> just that it's probably not the module you were expecting it to find.
>
> This is almost always because of the file name issue I mentioned above, OR
> because the wrong version of flask has been installed, or something similar.
>
> One thing to try would be at the *very* top of counters.py, add the
> following lines:
> import flask
> print(flask)
>
> then run your command again, and see what the stdout output is. You should
> see something like:
>
> <module 'flask' from 'XXXXXXXXX'>
>
> Does XXXXXX look like the right place for the flask installation? if not,
> then that's the problem.
After inserting the lines you told me i get the following when i try to run it via browser
[nikos at superhost wsgi]$ tail -f ../logs/error_log
[Thu Jul 08 19:22:31.042014 2021] [wsgi:error] [pid 575443:tid 139757777291008] [remote 89.210.199.119:4206] ImportError: cannot import name 'run'
[Thu Jul 08 19:22:32.723900 2021] [wsgi:error] [pid 575443:tid 139757752112896] <module 'flask' from '/usr/local/lib/python3.6/site-packages/flask/__init__.py'>
[Thu Jul 08 19:22:32.724068 2021] [wsgi:error] [pid 575443:tid 139757752112896] [remote 89.210.199.119:8556] mod_wsgi (pid=575443): Failed to exec Python script file '/home/nikos/wsgi/www.py'.
should i try always to run flask via browser or as "flask run" ? os is it the same?
More information about the Python-list
mailing list