2013-10-21 59 views
0

我想按照这个教程...瓶的应用程序将无法启动,我下面教程

http://flask.pocoo.org/docs/tutorial/setup/#tutorial-setup 

试图让一个简单的瓶的应用程序运行。我认为我几乎完全遵循了他们的代码,但我遇到了问题。我的代码是...

from flask import Flask, request, session, g, redirect, url_for, \ 
    abort, render_template, flash 

# configuration 
DATABASE = '' 
DEBUG = True 
SECRET_KEY = 'development key' 
USERNAME = 'admin' 
PASSWORD = 'default' 

sandra_source= Flask(__name__) 
sandra_source.config.from_object(__name__) 

def main(): 
    sandra_source.run() 

main() 

我认识到数据库是不一样的,但除此之外,它是相当现货。然而,我不断收到错误

AttributeError: 'module' object has no attribute 'sandra_service' 

我的模块名为sandra_service,所以我不知道这个错误是如何发生的。

堆栈跟踪

AttributeError: 'module' object has no attribute 'sandra_service' 
0  SandraImporter.load_module() c:\working\qzpkgs\quartz-14324978\win32_vc9\pylib\sandra\sandra_import.py:208 
1  <module>()     /playground/nbkiq0w/rester_app_root/services/sandra_service.py:20 
2  Config.from_object()   D:\quartz\WINSLA~1\WIN32-~1\build\ext\noarch\lib\python2.6\flask\config.py:146 
3 --> import_string()    D:\quartz\WINSLA~1\WIN32-~1\build\ext\noarch\lib\python2.6\werkzeug\utils.py:529 
+2

你确定这是你正在执行的代码吗?它可以很好地粘贴到文件中。 –

+0

不幸的是,我确定 – Zack

+0

你是使用execfile()还是只使用python文件名来运行它? – Drew

回答

0

不知道这是一个很好的答案或没有,但我去掉

sandra_source.config.from_object(__name__) 

这一行,现在的代码似乎是至少编译/运行。希望稍后更多的问题不会出现。