使用PasteDeploy管道的棱锥体脚本无法工作

2024-05-19 20:11:47 发布

您现在位置:Python中文网/ 问答频道 /正文

你好,这是我的新麻烦。。。 我使用金字塔,我已经创建了一个脚本来填充我的数据库的初始数据

我有一个PasteDeploy配置文件(比如开发.ini)使用此语法

###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###

[app:shop_eshop]
use = egg:shop_eshop

pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
    pyramid_debugtoolbar
    pyramid_tm

sqlalchemy.url = postgresql://eshop_db_user:testtest@localhost:5432/eshop_db

jinja2.directories = eshop:templates

ziggurat_foundations.model_locations.User = auth.models:User

# SESSION_BEAKER
session.type = file
session.data_dir = %(here)s/data/sessions/data
session.lock_dir = %(here)s/data/sessions/lock
session.key = s_key
session.secret = ...FBIRootAccessPW...
session.cookie_on_exception = true


[filter:fanstatic]
use = egg:fanstatic#fanstatic
recompute_hashes = false
versioning = true
bottom = True

publisher_signature = assets
compile = true
#in development
debug = true

[pipeline:main]
pipeline = fanstatic eshop

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###

[loggers]
keys = root, shop_eshop, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_shop_eshop]
level = DEBUG
handlers =
qualname = shop_eshop

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

我的脚本包含生成错误的这段代码。。在

^{pr2}$

错误由这行引发

engine = engine_from_config(settings, 'sqlalchemy.')

如果我删除管道一切正常,我无法找到读取管道的方法。在

这是我的错误

Traceback (most recent call last):
File "/srv/michael/e_shop/env/bin/fill_e_shop_db", line 9, in <module>
load_entry_point('e_shop==0.0', 'console_scripts', 'fill_e_shop_db')()
File "/srv/michael/e_shop/e_shop/e_shop/scripts/filldb.py", line 98, in main
engine = engine_from_config(settings, 'sqlalchemy.')
File "build/bdist.linux-x86_64/egg/sqlalchemy/engine/__init__.py", line 350, in engine_from_config
KeyError: 'url'

有什么建议吗?谢谢您!在


Tags: indebugpyramidfalsetruedbdatasqlalchemy
1条回答
网友
1楼 · 发布于 2024-05-19 20:11:47

get_appsettings()正在加载ini文件的main部分的设置,除非另有指定。很明显在那个部分没有设置。{{如果你想为cd3}指定一个特定的设置。例如,您现在应该能够运行程序并获得所需的结果:

myprog development.ini#shop_eshop

相关问题 更多 >