简体   繁体   English

我可以在Django中多次创建同一个应用程序吗?

[英]Can i create the same app multiple times in django?

I've created a fully functioning blog application in django . 我已经在django中创建了一个功能全面的博客应用程序。 But i want to create multiple blogs like i can create multiple posts on blog. 但是我想创建多个博客,就像我可以在博客上创建多个帖子一样。 How to approach this problem? 如何解决这个问题?

No, you cannot have multiple Django apps of the same name. 不可以,您不能有多个同名的Django应用。 But, much like you'd have a Post model for a singular blog you can create a Blog table and have each Post have a foreign key to the Blog that post belongs to. 但是,就像您对单个博客具有Post模型一样,您可以创建Blog表,并使每个Post都具有该帖子所属的Blog的外键。

每个django项目只有一个应用程序,因为我们应该在您的某些文件中导入view.pymodels.pyurls.py和...!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM