如何设置 web2py 固定装置
我正在尝试找到一种为我的 web2py 应用程序创建固定装置的方法。我遇到了 http://thadeusb.com/weblog/2010/4/21/using_fixtures_in_web2py 建议创建一个 x_fixtures.py 文件来放置所有灯具。问题是,一段时间后,文件会变得很大并且很难浏览。
我想要做的是拥有一个名为 fixtures/ 的文件夹,并将所有灯具放置在以它们所在的表命名的单独文件中。
官方 Web2py 书籍说“tests是一个用于存储测试脚本、装置和模拟的目录。”,但我也无法让它工作。默认情况下,该项目没有 tests 目录,因此我必须创建一个目录。
有人以前使用 web2py 以这种方式设置装置吗?如果没有,有什么建议可以尝试下一步吗?
I'm trying to find a way to create fixtures for my web2py application. I came across http://thadeusb.com/weblog/2010/4/21/using_fixtures_in_web2py that suggests creating a x_fixtures.py file to place all the fixtures in. The problem is that after a while, the file gets huge and a pain to navigate through.
What I want to be able to do is have a folder named fixtures/ and place all my fixtures in separate files named after the table they're for.
The Official Web2py Book says "tests is a directory for storing test scripts, fixtures and mocks.", but I haven't been able to get that to work either. The project didn't have a tests directory by default, so I had to create one.
Has anyone setup fixtures in this way using web2py before? If not, any suggestions on what to try next?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我不知道如何让固定装置在我创建的目录中工作web2py/applications/MyApp/tests/fixtures,但我确实得到了固定装置只需创建一个 web2py/applications/MyApp/models/fixtures 目录并为每个我想要的固定装置遵循 < 模式的表放置一个单独的文件即可按照我想要的方式工作强>x_fixtures_TABLE_NAME.py。
Well, I couldn't figure out how to get the fixtures to work while in the directory I created web2py/applications/MyApp/tests/fixtures, but I did get fixtures to work how I wanted by simply creating a web2py/applications/MyApp/models/fixtures directory and placing a separate file for each table I want fixtures for following the pattern of x_fixtures_TABLE_NAME.py.