librelist archives

« back to archive

Import error with Flask Mail

Import error with Flask Mail

From:
James Willson
Date:
2012-09-12 @ 08:22
Hi all,
I've had a bit of an issue where re-deploying my server caused UWSGI not 
to initalise my flask app. I traced it back to this error:
File "./app/__init__.py", line 3, in <module>    from flaskext.mail import
MailImportError: No module named flaskext.mailunable to load app 0 
(mountpoint='') (callable not found or import error)
In my requirements.txt I have this: Flask-Mail
In my __init__.py I have this at the top: from flaskext.mail import Mail
Where am I going wrong here? Any help would be much appreciated.
James
 		 	   		  

Re: [flask] Import error with Flask Mail

From:
Bernat
Date:
2012-09-12 @ 08:44
Al 12/09/12 10:22, En/na James Willson ha escrit:
> Hi all,
>
> I've had a bit of an issue where re-deploying my server caused UWSGI 
> not to initalise my flask app. I traced it back to this error:
>
> File "./app/__init__.py", line 3, in <module>
>     from flaskext.mail import Mail
> ImportError: No module named flaskext.mail
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
> In my requirements.txt I have this:
> Flask-Mail
>
> In my __init__.py I have this at the top:& nbsp;
> from flaskext.mail import Mail
>
> Where am I going wrong here? Any help would be much appreciated.

I have had recently a similar error and the problem was resolved 
updating the Flas-Mail to the last version 0.7.1 and use

     from flask_mail import Mail

Cheers!

>
> James
>


-- 
bernat

Re: [flask] Import error with Flask Mail

From:
James Willson
Date:
2012-09-12 @ 15:50
Hi.
I'm still having a hard time with this. This is what I have now:
My config:
MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'MAIL_PORT : 
25MAIL_USE_TLS : TrueMAIL_USE_SSL : FalseMAIL_DEBUG : 
app.debugMAIL_USERNAME : ABCMAIL_PASSWORD : ABCDEFAULT_MAIL_SENDER : None
###########################################
The top of my init config:
from flask import Flask, render_templatefrom flask.ext.sqlalchemy import 
SQLAlchemyfrom flask.ext.mail import Mail
###########################################
My error:
Traceback (most recent call last):
File "./app/__init__.py", line 6, in <module>
app.config.from_object('config')
File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line
162, in from_object        obj = import_string(obj)
File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", 
line 411, in import_string    return __import__(import_name)
File "./config.py", line 28
MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'
^
SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
Date: Wed, 12 Sep 2012 08:51:33 -0400
From: techniq35@gmail.com
Subject: Re: [flask] Import error with Flask Mail
To: flask@librelist.com

Regarding the import error, you should also be able to use "flask.ext.mail
import Mail" along with "from flask_mail import Mail" (notice the '.' 
between 'flask' and 'ext')


On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org> wrote:

Le 12/09/2012 13:18, James Willson a écrit :

>    File "./app/__init__.py", line 6, in <module>

>      app.config.from_object('config')



If you’re using from_object, the file needs to be in Python syntax, like

this:



MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'

MAIL_PORT = 25

...



Regards,

--

Simon Sapin


 		 	   		  

Re: [flask] Import error with Flask Mail

From:
Mark Steve Samson
Date:
2012-09-12 @ 15:59
If the config is in python, why are you using ":" for variable setting?  

--  
Steve


On Wednesday, September 12, 2012 at 11:50 PM, James Willson wrote:

> Hi.
>  
> I'm still having a hard time with this. This is what I have now:
>  
> My config:
>  
> MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'
> MAIL_PORT : 25
> MAIL_USE_TLS : True
> MAIL_USE_SSL : False
> MAIL_DEBUG : app.debug
> MAIL_USERNAME : ABC
> MAIL_PASSWORD : ABC
> DEFAULT_MAIL_SENDER : None
>  
> ###########################################
>  
> The top of my init config:
>  
> from flask import Flask, render_template
> from flask.ext.sqlalchemy import SQLAlchemy
> from flask.ext.mail import Mail
>  
> ###########################################
>  
> My error:
>  
> Traceback (most recent call last):

>   File "./app/__init__.py", line 6, in <module>

>     app.config.from_object('config')

>   File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", 
line 162, in from_object     
>     obj = import_string(obj)

>   File 
"/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", line 
411, in import_string
>     return __import__(import_name)

>   File "./config.py", line 28

>     MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'

>                 ^

> SyntaxError: invalid syntax

> unable to load app 0 (mountpoint='') (callable not found or import 
error)                            
> *** no app loaded. going in full dynamic mode ***

> *** uWSGI is running in multiple interpreter mode ***
>  
> Date: Wed, 12 Sep 2012 08:51:33 -0400
> From: techniq35@gmail.com (mailto:techniq35@gmail.com)
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com (mailto:flask@librelist.com)
>  
> Regarding the import error, you should also be able to use 
"flask.ext.mail import Mail" along with "from flask_mail import Mail" 
(notice the '.' between 'flask' and 'ext')
>  
> On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org 
(mailto:simon.sapin@exyr.org)> wrote:
> > Le 12/09/2012 13:18, James Willson a écrit :
> > >    File "./app/__init__.py", line 6, in <module>
> > >      app.config.from_object('config')
> >  
> > If you’re using from_object, the file needs to be in Python syntax, like
> > this:
> >  
> > MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'
> > MAIL_PORT = 25
> > ...
> >  
> > Regards,
> > --
> > Simon Sapin
>  

Re: [flask] Import error with Flask Mail

From:
Kerem Ulutaş
Date:
2012-09-12 @ 15:59
If you don't have any tab / space mixed up, the only problem is the colons,
replace them with = so the config should be like this:

MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'
MAIL_PORT = 25
...

2012/9/12 James Willson <james_willson@hotmail.com>

> Hi.
>
> I'm still having a hard time with this. This is what I have now:
>
> My config:
>
> MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'
> MAIL_PORT : 25
> MAIL_USE_TLS : True
> MAIL_USE_SSL : False
> MAIL_DEBUG : app.debug
> MAIL_USERNAME : ABC
> MAIL_PASSWORD : ABC
> DEFAULT_MAIL_SENDER : None
>
> ###########################################
>
> The top of my init config:
>
> from flask import Flask, render_template
> from flask.ext.sqlalchemy import SQLAlchemy
> from flask.ext.mail import Mail
>
> ###########################################
>
> My error:
>
> Traceback (most recent call last):
>
>   File "./app/__init__.py", line 6, in <module>
>
>     app.config.from_object('config')
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py",
> line 162, in from_object
>     obj = import_string(obj)
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py",
> line 411, in import_string
>     return __import__(import_name)
>
>   File "./config.py", line 28
>
>     MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'
>
>                 ^
>
> SyntaxError: invalid syntax
>
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
> *** no app loaded. going in full dynamic mode ***
>
> *** uWSGI is running in multiple interpreter mode ***
>
> ------------------------------
> Date: Wed, 12 Sep 2012 08:51:33 -0400
> From: techniq35@gmail.com
>
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com
>
> Regarding the import error, you should also be able to use "flask.ext.mail
> import Mail" along with "from flask_mail import Mail" (notice the '.'
> between 'flask' and 'ext')
>
> On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
>
> Le 12/09/2012 13:18, James Willson a écrit :
> >    File "./app/__init__.py", line 6, in <module>
> >      app.config.from_object('config')
>
> If you’re using from_object, the file needs to be in Python syntax, like
> this:
>
> MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'
> MAIL_PORT = 25
> ...
>
> Regards,
> --
> Simon Sapin
>
>
>


-- 

Blog'umu okudunuz mu? http://www.ulutas.gen.tr

The box said "Requires Windows 95, NT, or better", so I installed Linux.

Re: [flask] Import error with Flask Mail

From:
Bernat
Date:
2012-09-12 @ 16:04
Try to change the ":" for "=" as Simon say.


Al 12/09/12 17:50, En/na James Willson ha escrit:
> Hi.
>
> I'm still having a hard time with this. This is what I have now:
>
> My config:
>
> MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'
> MAIL_PORT : 25
> MAIL_USE_TLS : True
> MAIL_USE_SSL : False
> MAIL_DEBUG : app.debug
> MAIL_USERNAME : ABC
> MAIL_PASSWORD : ABC
> DEFAULT_MAIL_SENDER : None
>
> ###########################################
>
> The top of my init config:
>
> from flask import Flask, render_template
> from flask.ext.sqlalchemy import SQLAlchemy
> from flask.ext.mail import Mail
>
> ###########################################
>
> My error:
>
> Traceback (most recent call last):
>   File "./app/__init__.py", line 6, in <module>
>     app.config.from_object('config')
>   File 
> "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line 
> 162, in from_object
>     obj = import_string(obj)
>   File 
> "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", 
> line 411, in import_string
>     return __import__(import_name)
>   File "./config.py", line 28
>     MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com'
>                 ^
> SyntaxError: invalid syntax
> unable to load app 0 (mountpoint='') (callable not found or import error)
> *** no app loaded. going in full dynamic mode ***
> *** uWSGI is running in multiple interpreter mode ***
>
> ------------------------------------------------------------------------
> Date: Wed, 12 Sep 2012 08:51:33 -0400
> From: techniq35@gmail.com
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com
>
> Regarding the import error, you should also be able to use 
> "flask.ext.mail import Mail" along with "from flask_mail import Mail" 
> (notice the '.' between 'flask' and 'ext')
>
> On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org 
> <mailto:simon.sapin@exyr.org>> wrote:
>
>     Le 12/09/2012 13:18, James Willson a écrit :
>     >    File "./app/__init__.py", line 6, in <module>
>     >      app.config.from_object('config')
>
>     If you’re using from_object, the file needs to be in Python
>     syntax, like
>     this:
>
>     MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com
>     <http://email-smtp.us-east-1.amazonaws.com>'
>     MAIL_PORT = 25
>     ...
>
>     Regards,
>     --
>     Simon Sapin
>
>


-- 
bernat

Re: [flask] Import error with Flask Mail

From:
James Willson
Date:
2012-09-12 @ 10:03
Aha! Well, that sorted one problem out, but maybe I can push my luck and 
ask for help on this new error:
=====================================================================
Traceback (most recent call last):
File "./app/__init__.py", line 6, in <module>
app.config.from_object('config')
File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line
162, in from_object        obj = import_string(obj)
File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", 
line 411, in import_string    return __import__(import_name)
File "./config.py", line 28
MAIL_SERVER : default 'email-smtp.us-east-1.amazonaws.com'
^
SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)

=====================================================================
Is there something wrong with how I have formated my "MAIL_SERVER" line in
the config?
Date: Wed, 12 Sep 2012 10:44:47 +0200
From: cow@cowdot.com
Subject: Re: [flask] Import error with Flask Mail
To: flask@librelist.com


  
    
  
  
    Al 12/09/12 10:22, En/na James Willson ha escrit:
    
      
      
        Hi all,
        

          
        I've had a bit of an issue where
            re-deploying my server caused UWSGI not to initalise my
            flask app. I traced it back to this error:
        

          
        File "./app/__init__.py", line 3, in
            <module>
            from flaskext.mail import Mail
        ImportError: No module named
            flaskext.mail
        unable to load app 0 (mountpoint='')
            (callable not found or import error)
        

          
        In my requirements.txt I have this: 
        Flask-Mail
        

          
        In my __init__.py I have this at the
            top:& nbsp;
        from flaskext.mail import Mail
        

          
        Where am I going wrong here? Any help
            would be much appreciated.
      
    
    

    I have had recently a similar error and the problem was resolved
    updating the Flas-Mail to the last version 0.7.1 and use

    

        from flask_mail import Mail

    

    Cheers!

    

    
      
        

          
        James
        

        
      
    
    

    

    -- 
bernat 		 	   		  

Re: [flask] Import error with Flask Mail

From:
Kerem Ulutaş
Date:
2012-09-12 @ 10:17
try

from flask.ext.mail import Mail

2012/9/12 James Willson <james_willson@hotmail.com>

> Aha! Well, that sorted one problem out, but maybe I can push my luck and
> ask for help on this new error:
>
> =====================================================================
>
> Traceback (most recent call last):
>
>   File "./app/__init__.py", line 6, in <module>
>
>     app.config.from_object('config')
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py",
> line 162, in from_object
>     obj = import_string(obj)
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py",
> line 411, in import_string
>     return __import__(import_name)
>
>   File "./config.py", line 28
>
>     MAIL_SERVER : default 'email-smtp.us-east-1.amazonaws.com'
>
>                 ^                             &nb sp;
>
> SyntaxError: invalid syntax
>
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
> =====================================================================
>
> Is there something wrong with how I have formated my "MAIL_SERVER" line in
> the config?
>
> ------------------------------
> Date: Wed, 12 Sep 2012 10:44:47 +0200
> From: cow@cowdot.com
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com
>
>
> Al 12/09/12 10:22, En/na James Willson ha escrit:
>
>  Hi all,
>
>  I've had a bit of an issue where re-deploying my server caused UWSGI not
> to initalise my flask app. I traced it back to this error:
>
>  File "./app/__init__.py", line 3, in <module>
>     from flaskext.mail import Mail
> ImportError: No module named flaskext.mail
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
>  In my requirements.txt I have this:
> Flask-Mail
>
>  In my __init__.py I have this at the top:& nbsp;
> from flaskext.mail import Mail
>
>  Where am I going wrong here? Any help would be much appreciated.
>
>
> I have had recently a similar error and the problem was resolved updating
> the Flas-Mail to the last version 0.7.1 and use
>
>     from flask_mail import Mail
>
> Cheers!
>
>
>  James
>
>
>
> --
> bernat
>
>


-- 

Blog'umu okudunuz mu? http://www.ulutas.gen.tr

The box said "Requires Windows 95, NT, or better", so I installed Linux.

Re: [flask] Import error with Flask Mail

From:
Simon Sapin
Date:
2012-09-12 @ 11:04
Le 12/09/2012 12:03, James Willson a écrit :
>    File "./config.py", line 28
>      MAIL_SERVER : default 'email-smtp.us-east-1.amazonaws.com'
>                  ^                             &nb sp;
> SyntaxError: invalid syntax
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
> =====================================================================
>
> Is there something wrong with how I have formated my "MAIL_SERVER" line
> in the config?

Probably. Can you show us the full config.py file, or at least some 
context around the MAIL_SERVER line?

-- 
Simon Sapin

Re: [flask] Import error with Flask Mail

From:
James Willson
Date:
2012-09-12 @ 11:18
Hi,
This is my config, changed username and pass: 
MAIL_SERVER : default email-smtp.us-east-1.amazonaws.comMAIL_PORT : 
default 25MAIL_USE_TLS : default TrueMAIL_USE_SSL : default 
FalseMAIL_DEBUG : default app.debugMAIL_USERNAME : default 
abcMAIL_PASSWORD : default abcDEFAULT_MAIL_SENDER : default None
This is now the line in my init:from flask.ext.mail import Mail
This is the latest error I got with this:Traceback (most recent call 
last):                                                                    
File "./app/__init__.py", line 6, in <module>
app.config.from_object('config')
File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line
162, in from_object        obj = import_string(obj)
File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", 
line 411, in import_string    return __import__(import_name)
File "./config.py", line 28
MAIL_SERVER : default email-smtp.us-east-1.amazonaws.com
^
SyntaxError: invalid syntax
unable to load app 0 (mountpoint='') (callable not found or import error)
> Date: Wed, 12 Sep 2012 13:04:04 +0200
> From: simon.sapin@exyr.org
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com
> 
> Le 12/09/2012 12:03, James Willson a écrit :
> >    File "./config.py", line 28
> >      MAIL_SERVER : default 'email-smtp.us-east-1.amazonaws.com'
> >                  ^                             &nb sp;
> > SyntaxError: invalid syntax
> > unable to load app 0 (mountpoint='') (callable not found or import error)
> >
> > =====================================================================
> >
> > Is there something wrong with how I have formated my "MAIL_SERVER" line
> > in the config?
> 
> Probably. Can you show us the full config.py file, or at least some 
> context around the MAIL_SERVER line?
> 
> -- 
> Simon Sapin
 		 	   		  

Re: [flask] Import error with Flask Mail

From:
Kerem Ulutaş
Date:
2012-09-12 @ 11:25
Why do you have the "default" words? You are supposed to have settings like:

MAIL_SERVER : "email-smtp.us-east-1.amazonaws.com"
MAIL_PORT : 25
..

I hope that helps.

2012/9/12 James Willson <james_willson@hotmail.com>

> Hi,
>
> This is my config, changed username and pass:
>
> MAIL_SERVER : default email-smtp.us-east-1.amazonaws.com
> MAIL_PORT : default 25
> MAIL_USE_TLS : default True
> MAIL_USE_SSL : default False
> MAIL_DEBUG : default app.debug
> MAIL_USERNAME : default abc
> MAIL_PASSWORD : default abc
> DEFAULT_MAIL_SENDER : default None
>
> This is now the line in my init:
> from flask.ext.mail import Mail
>
> This is the latest error I got with this:
> Traceback (most recent call last):
>
>   File "./app/__init__.py", line 6, in <module>
>
>     app.config.from_object('config')
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py",
> line 162, in from_object
>     obj = import_string(obj)
>
>   File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py",
> line 411, in import_string
>     return __import__(import_name)
>
>   File "./config.py", line 28
>
>     MAIL_SERVER : default email-smtp.us-east-1.amazonaws.com
>
>                 ^
>
> SyntaxError: invalid syntax
>
> unable to load app 0 (mountpoint='') (callable not found or import error)
>
> > Date: Wed, 12 Sep 2012 13:04:04 +0200
> > From: simon.sapin@exyr.org
>
> > Subject: Re: [flask] Import error with Flask Mail
> > To: flask@librelist.com
> >
> > Le 12/09/2012 12:03, James Willson a écrit :
> > > File "./config.py", line 28
> > > MAIL_SERVER : default 'email-smtp.us-east-1.amazonaws.com'
> > > ^ &nb sp;
> > > SyntaxError: invalid syntax
> > > unable to load app 0 (mountpoint='') (callable not found or import
> error)
> > >
> > > =====================================================================
> > >
> > > Is there something wrong with how I have formated my "MAIL_SERVER" line
> > > in the config?
> >
> > Probably. Can you show us the full config.py file, or at least some
> > context around the MAIL_SERVER line?
> >
> > --
> > Simon Sapin
>



-- 

Blog'umu okudunuz mu? http://www.ulutas.gen.tr

The box said "Requires Windows 95, NT, or better", so I installed Linux.

Re: [flask] Import error with Flask Mail

From:
Simon Sapin
Date:
2012-09-12 @ 11:26
Le 12/09/2012 13:18, James Willson a écrit :
>    File "./app/__init__.py", line 6, in <module>
>      app.config.from_object('config')

If you’re using from_object, the file needs to be in Python syntax, like 
this:

MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'
MAIL_PORT = 25
...

Regards,
-- 
Simon Sapin

Re: [flask] Import error with Flask Mail

From:
Sean Lynch
Date:
2012-09-12 @ 12:51
Regarding the import error, you should also be able to use "flask.ext.mail
import Mail" along with "from flask_mail import Mail" (notice the '.'
between 'flask' and 'ext')

On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org> wrote:

> Le 12/09/2012 13:18, James Willson a écrit :
> >    File "./app/__init__.py", line 6, in <module>
> >      app.config.from_object('config')
>
> If you’re using from_object, the file needs to be in Python syntax, like
> this:
>
> MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'
> MAIL_PORT = 25
> ...
>
> Regards,
> --
> Simon Sapin
>

Re: [flask] Import error with Flask Mail

From:
James Willson
Date:
2012-09-13 @ 10:02
I feel a bit like a blind man trying to get through a maze. The error im 
getting now is this:
Traceback (most recent call last):
File "./app/__init__.py", line 6, in <module>
app.config.from_object('config')
File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line
162, in from_object        obj = import_string(obj)
File "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", 
line 411, in import_string    return __import__(import_name)
File "./config.py", line 32, in <module>
MAIL_DEBUG = app.debug
NameError: name 'app' is not defined
unable to load app 0 (mountpoint='') (callable not found or import error)

Where should I be defining "app"? On my init I have this near the top:
app = Flask(__name__)app.config.from_object('config')db = 
SQLAlchemy(app)mail = Mail(app)
Date: Wed, 12 Sep 2012 18:04:35 +0200
From: cow@cowdot.com
Subject: Re: [flask] Import error with Flask Mail
To: flask@librelist.com


  
    
  
  
    Try to change the ":" for "=" as Simon say.

    

    

    Al 12/09/12 17:50, En/na James Willson ha escrit:
    
      
      
        Hi.
        

          
        I'm still having a hard time with
            this. This is what I have now:
        

          
        My config:
        

          
        MAIL_SERVER :
            'email-smtp.us-east-1.amazonaws.com'
        MAIL_PORT : 25
        MAIL_USE_TLS : True
        MAIL_USE_SSL : False
        MAIL_DEBUG : app.debug
        MAIL_USERNAME : ABC
        MAIL_PASSWORD : ABC
        DEFAULT_MAIL_SENDER : None
        

          
        ###########################################
        

          
        The top of my init config:
        

          
        from flask import Flask,
            render_template
        from flask.ext.sqlalchemy import
            SQLAlchemy
        from flask.ext.mail import Mail
        

          
        ###########################################
        

          
        My error:
        

          
        Traceback (most recent call last):    
                                                                       
             
          File "./app/__init__.py", line 6, in
            <module>                                              
                  
            app.config.from_object('config')  
                                                                       
             
          File
            "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py",
            line 162, in from_object    
            obj = import_string(obj)          
                                                                       
             
          File
            "/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py",
            line 411, in import_string
            return __import__(import_name)    
                                                                       
             
          File "./config.py", line 28        
                                                                       
              
            MAIL_SERVER :
            'email-smtp.us-east-1.amazonaws.com'                        
                                 
                        ^                    
                                                                       
              
        SyntaxError: invalid syntax          
                                                                       
              
        unable to load app 0 (mountpoint='')
            (callable not found or import error)                        
              
        *** no app loaded. going in full
            dynamic mode ***                                            
                  
        *** uWSGI is running in multiple
            interpreter mode ***
        

        
          Date: Wed, 12 Sep 2012 08:51:33 -0400

          From: techniq35@gmail.com

          Subject: Re: [flask] Import error with Flask Mail

          To: flask@librelist.com

          

          Regarding the import error, you should also be able to use
          "flask.ext.mail import Mail" along with "from flask_mail
          import Mail" (notice the '.' between 'flask' and 'ext')

          

          On Wed, Sep 12, 2012 at 7:26 AM,
            Simon Sapin <simon.sapin@exyr.org>
            wrote:

            
              Le 12/09/2012 13:18, James Willson a écrit :

              >    File "./app/__init__.py", line
                6, in <module>

                >      app.config.from_object('config')

                

              
              If you’re using from_object, the file needs to be in
              Python syntax, like

              this:

              

              MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'

              MAIL_PORT = 25

              ...

              

              Regards,

              --

                  Simon Sapin

                
          
          

        
      
    
    

    

    -- 
bernat 		 	   		  

Re: [flask] Import error with Flask Mail

From:
Mark Steve Samson
Date:
2012-09-13 @ 10:12
MAIL_DEBUG = DEBUG should make more sense. You need to define DEBUG first 
though. I suggest brushing up on basics before proceeding. You will feel 
like a blind man with that approach.  

--  
Steve


On Thursday, September 13, 2012 at 6:02 PM, James Willson wrote:

>  
> I feel a bit like a blind man trying to get through a maze. The error im
getting now is this:
>  
> Traceback (most recent call last):

>   File "./app/__init__.py", line 6, in <module>

>     app.config.from_object('config')

>   File "/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", 
line 162, in from_object     
>     obj = import_string(obj)

>   File 
"/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", line 
411, in import_string
>     return __import__(import_name)

>   File "./config.py", line 32, in <module>

>     MAIL_DEBUG = app.debug

> NameError: name 'app' is not defined

> unable to load app 0 (mountpoint='') (callable not found or import error)   
>  
> Where should I be defining "app"? On my init I have this near the top:
>  
> app = Flask(__name__)
> app.config.from_object('config')
> db = SQLAlchemy(app)
> mail = Mail(app)
>  
> Date: Wed, 12 Sep 2012 18:04:35 +0200
> From: cow@cowdot.com (mailto:cow@cowdot.com)
> Subject: Re: [flask] Import error with Flask Mail
> To: flask@librelist.com (mailto:flask@librelist.com)
>  
> Try to change the ":" for "=" as Simon say.
>  
>  
> Al 12/09/12 17:50, En/na James Willson ha escrit:  
> > Hi.
> >  
> > I'm still having a hard time with this. This is what I have now:  
> >  
> > My config:  
> >  
> > MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'  
> > MAIL_PORT : 25
> > MAIL_USE_TLS : True
> > MAIL_USE_SSL : False
> > MAIL_DEBUG : app.debug
> > MAIL_USERNAME : ABC
> > MAIL_PASSWORD : ABC
> > DEFAULT_MAIL_SENDER : None
> >  
> > ###########################################  
> >  
> > The top of my init config:  
> >  
> > from flask import Flask, render_template  
> > from flask.ext.sqlalchemy import SQLAlchemy
> > from flask.ext.mail import Mail
> >  
> > ###########################################  
> >  
> > My error:  
> >  
> > Traceback (most recent call last):

> >   File "./app/__init__.py", line 6, in <module>

> >     app.config.from_object('config')

> >   File 
"/home/deploy/venv/lib/python2.7/site-packages/flask/config.py", line 162,
in from_object     
> >     obj = import_string(obj)

> >   File 
"/home/deploy/venv/lib/python2.7/site-packages/werkzeug/utils.py", line 
411, in import_string
> >     return __import__(import_name)

> >   File "./config.py", line 28

> >     MAIL_SERVER : 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'

> >                 ^

> > SyntaxError: invalid syntax

> > unable to load app 0 (mountpoint='') (callable not found or import 
error)                            
> > *** no app loaded. going in full dynamic mode ***

> > *** uWSGI is running in multiple interpreter mode ***
> >  
> > Date: Wed, 12 Sep 2012 08:51:33 -0400
> > From: techniq35@gmail.com (mailto:techniq35@gmail.com)
> > Subject: Re: [flask] Import error with Flask Mail
> > To: flask@librelist.com (mailto:flask@librelist.com)
> >  
> > Regarding the import error, you should also be able to use 
"flask.ext.mail import Mail" along with "from flask_mail import Mail" 
(notice the '.' between 'flask' and 'ext')
> >  
> > On Wed, Sep 12, 2012 at 7:26 AM, Simon Sapin <simon.sapin@exyr.org 
(mailto:simon.sapin@exyr.org)> wrote:
> > > Le 12/09/2012 13:18, James Willson a écrit :
> > > >    File "./app/__init__.py", line 6, in <module>
> > > >      app.config.from_object('config')
> > >  
> > > If you’re using from_object, the file needs to be in Python syntax, like
> > > this:
> > >  
> > > MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com 
(http://email-smtp.us-east-1.amazonaws.com)'
> > > MAIL_PORT = 25
> > > ...
> > >  
> > > Regards,
> > > --
> > > Simon Sapin
> >  
>  
>  
> -- bernat