Closed adrianblakey closed 3 years ago
Step 1. Update all the packages ot the newest versions. Step 2. Add email-validator==1.1.2 to requirements.txt and install it. Step 3. flask db upgrade Step 4. Install elasticsearch: docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2; docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.10.2 Step 5. Install redis: docker run --name my-redis -p 6379:6379 --restart always --detach redis Step 6. Sign up for MS/Azure translator an grab the key. Step 7. edit config.py for email es/redis etc. Step 8. Run the unittest - passed. Step 9. Run it again ...
/Users/ajb/microblog/venv/bin/python /Users/ajb/microblog/app/init.py
Traceback (most recent call last):
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/serving.py", line 58, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ajb/microblog/app/init.py", line 4, in
Process finished with exit code 1
Have you tried not upgrading all packages to their latest? The whole point of having a requirements file is to include the list of tested dependencies. In fact you've already found the one requiring the email_validator package to be installed. There might be others.
The email_validator
change was already reported and I will incorporate it. Maybe something else has also changed recently and needs an adjustment.
Yes - I left requirements.txt alone to begin with - that's the first post. The first thing I did was add email_validator. I am running Python 3.9 - I wonder if that might be an issue. For grins I ran the docker build/run (Py 3.6) - which executes successfully. So I guess the issues are related to Py 3.9.
As luck would not have it: pyenv install 3.6.x fails on Big Sur - typical. Pain in the neck cause I'd really like to edit it in PyCharm. The python.org package installer for 3.6.8 seems to work tho.
Edit pycharm like this: https://stackoverflow.com/questions/20732904/how-to-debug-flask-app-with-pycharm-2-x-thats-running-on-gunicorn basically to copy run.sh into "Edit configurations" - then run it from gunicorn - ta dah - works.
I don't see any problems while running on 3.9. I have now updated the requirements file, I did not get any errors with the old or the upgraded dependencies.
What's the process once this has been git cloned to get this to run?
I followed the tutorial to a point where I wanted to run the complete solution. I fired it up in PyCharm with a venv 3.9 on MacOs.
Whether or not I install the latest modules the traceback on run is:
/Users/ajb/microblog/venv/bin/python /Users/ajb/microblog/app/init.py Traceback (most recent call last): File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/http.py", line 23, in
from email.utils import parsedate_tz
File "/Users/ajb/microblog/app/email.py", line 2, in
from flask import current_app
ImportError: cannot import name 'current_app' from partially initialized module 'flask' (most likely due to a circular import) (/Users/ajb/microblog/venv/lib/python3.9/site-packages/flask/init.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/ajb/microblog/app/init.py", line 4, in
from flask import Flask, request, current_app
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/flask/init.py", line 17, in
from werkzeug.exceptions import abort
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/init.py", line 151, in
import('werkzeug.exceptions')
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/exceptions.py", line 71, in
from werkzeug.wrappers import Response
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/wrappers.py", line 27, in
from werkzeug.http import HTTP_STATUS_CODES, \
File "/Users/ajb/microblog/venv/lib/python3.9/site-packages/werkzeug/http.py", line 25, in
from email.Utils import parsedate_tz
File "/Users/ajb/microblog/app/email.py", line 2, in
from flask import current_app
ImportError: cannot import name 'current_app' from partially initialized module 'flask' (most likely due to a circular import) (/Users/ajb/microblog/venv/lib/python3.9/site-packages/flask/init.py)
Process finished with exit code 1