Online interpretations are basically the same pattern, to be honest, I do not really understand the principles involved, but some knowledge, there may be a relationship with the context celery:
First, I get the error message is:
This is celery to create worker, sending mail, click the activation, the pop-up error message:
The basic explanation is the Internet:
-------> "Say the application can not create a URL for the adapter is not related to the request of the generated URL, you can solve this problem by setting SERVER_NAME.
>>> app.config['SERVER_NAME'] = 'example.com' >>> with app.app_context(): ... print url_for('index', _external=True) ...
# results:
http://example.com/
PS: General SERVER_NAME is set to site's domain name.
There are so many words in Flask-Mail related article:
Many Flask extensions are assumed to own and run the application requests an active context, Flask-Mail is send function uses to current_app this context, so when mail.send () function is executed in one thread of human needs create a context, all in send_async_email in the app.app_context () to create a context.
Therefore, to generate a request does not depend on the absolute URL (such as creating a page of the site URL in the message when the message is sent asynchronously), it is necessary to set the SERVER_NAME. "
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Overall, there may be a relationship with the flask and celery current_app context, I do not have in-depth understanding of the specific, so a temporary solution how to use:
When initializing the app, add SERVER_NAME configuration, the project started with the same address address:
Then I start address port project are:
In this case, my project can send messages correctly and click Activate jump back to the specified address.