How to integrate Django-CMS into an existing project

送分小仙女□ 提交于 2020-01-12 19:04:39

问题


I need to integrate Django-CMS 3.x into an existing project (mypjc hereafter). I already checked this question (and other similar) but they point to a tutorial page that is no longer available.

I'm a bit confused by the tons of infos you can find online and I have not really understood if Django-CMS can be integrated as an app into an existing and independently running Django project.

mypjc (using Django 1.8) would benefit from a user friendly CMS. Basically I'd the user to be able to write texts and to load in their posts images stored in the (common) database, images that are created by the user in mypjc.

Is it possible? if yes, could anyone help me defying the steps needed to make the integration clean and successful?

Thank you in advance for any help you could provide.


回答1:


With Django CMS, it is indeed possible to integrate it into an existing project.

If you already have an existing project with URL/menu management, then you can simply integrate just the per-page CMS, which can be added as additional field to your model:

from django.db import models
from cms.models.fields import PlaceholderField

class MyModel(models.Model):
    # your fields
    my_placeholder = PlaceholderField('placeholder_name')
    # your methods

You can find more information here.

For any existing projects, you are likely to need to use the manual installation process outlined here.



来源:https://stackoverflow.com/questions/40022161/how-to-integrate-django-cms-into-an-existing-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!