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
4

1 回答 1

0

不确定这是否是一个很好的答案,但我删除了

sandra_source.config.from_object(__name__)

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

于 2013-10-23T19:22:27.197 回答