Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

執行問題 #1

Open
yuyu0520 opened this issue Jul 30, 2024 · 1 comment
Open

執行問題 #1

yuyu0520 opened this issue Jul 30, 2024 · 1 comment

Comments

@yuyu0520
Copy link

你好~正在學習pecan框架,想利用你的code來做範本練習,請問一下執行指令是pecan serve config.py嗎?執行時有碰到以下錯誤代碼:
Traceback (most recent call last):
File "/home/may/venv/lib/python3.8/site-packages/pecan/configuration.py", line 110, in getattr
return self.values[name]
KeyError: 'server'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/may/venv/bin/pecan", line 11, in
load_entry_point('pecan', 'console_scripts', 'pecan')()
File "/home/may/venv/lib/python3.8/site-packages/pecan/commands/base.py", line 97, in handle_command_line
runner.run(sys.argv[1:])
File "/home/may/venv/lib/python3.8/site-packages/pecan/commands/base.py", line 92, in run
self.commandsns.command_name.run(ns)
File "/home/may/venv/lib/python3.8/site-packages/pecan/commands/serve.py", line 39, in run
self.serve(app, app.config)
File "/home/may/venv/lib/python3.8/site-packages/pecan/commands/serve.py", line 152, in serve
self._serve(app, conf)
File "/home/may/venv/lib/python3.8/site-packages/pecan/commands/serve.py", line 115, in _serve
host, port = conf.server.host, int(conf.server.port)
File "/home/may/venv/lib/python3.8/site-packages/pecan/configuration.py", line 113, in getattr
raise AttributeError(msg)
AttributeError: 'pecan.conf' object has no attribute 'server'

@yuyu0520
Copy link
Author

試著用cmd/api.py執行,也會有以下問題:
python api.py
Traceback (most recent call last):
File "api.py", line 13, in
main()
File "api.py", line 8, in main
application = app.setup_app()
TypeError: setup_app() missing 1 required positional argument: 'config'

查看setup_app() func並不需要帶任何參數,請問是我有缺少什麼參數嗎?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant