第一次如何自动初始化django对象? [英] How to initialize django objects automatically for the first time?

查看:47
本文介绍了第一次如何自动初始化django对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个django应用程序,我四处寻找找不到答案的答案.

This is my first django application and I looked all over the place to find an answer, to no avail.

我创建了我的模型,并且知道需要将值初始化为一个类.我可以使用管理页面一个接一个地完成此操作,但是我希望使用我的应用程序的任何人都能够第一次加载该应用程序,以自动创建所有正确的对象(以及数据库中的关联记录)

I created my models and I know need to to initialize the values to one of the classes. I could do it using the admin page, one by one, but I want anyone using my application to be able to just load the application for the first time to have all the correct objects (and associated records in the database) to be created automatically.

请帮助

推荐答案

如果要填充数据库,请检查Wiki中的

If you want to populate database check the wiki for initial data. You can use JSON, XML or YAML (with PyYAML installed). I think you are looking for this as your question is not that clear.

这篇关于第一次如何自动初始化django对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆