I already have an existing Django website. I have added a new url route '/blog/' where I would like to have a Mezzanine blog. If it possible to installed Mezzanine as an app in an existing Django site as opposed to a standalone blog application.
            Asked
            
        
        
            Active
            
        
            Viewed 4,467 times
        
    16
            
            
        - 
                    I have tried this quite a bit with no luck; would like to know how to achieve this too. Mezzanine is a CMS, and it has its only runserver, etc. I believe it is not possible to do this. – karthikr Mar 27 '13 at 19:21
 
2 Answers
13
            
            
        If you are like me, you will find that the FAQ is sorely lacking in its description of how to get Mezzanine working as an app. So here is what I did (after a painful half day of hacking) to get it integrated (somewhat):
- Download the repo and copy it into your project
 - Run setup.py for the package
 cdto the package and run the mezzanine command to create a new app (mezzanine-project <project name>), let's say you use the nameblogas your<project_name>.- In either the 
local_settings.pyorsettings.pyfile, set theDATABASESdict to use your project's database. - Run the 
createdbcommand from the mezzaninemanage.pyfile 
Now it's time to start the hack-fest:
- In your project's settings.py file, add 
blogtoINSTALLED_APPS - Add some configuration variables to settings.py that Mezzanine is expecting:
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe" PACKAGE_NAME_GRAPPELLI = "grappelli_safe" GRAPPELLI_INSTALLED = False ADMIN_REMOVAL = [] RATINGS_RANGE = range(1, 5) TESTING = False BLOG_SLUG = '' COMMENTS_UNAPPROVED_VISIBLE = True COMMENTS_REMOVED_VISIBLE = False COMMENTS_DEFAULT_APPROVED = True COMMENTS_NOTIFICATION_EMAILS = ",".join(ALL_EMAILS) COMMENT_FILTER = None - Add some middleware that Mezzanine is expecting:
````
...
"mezzanine.core.request.CurrentRequestMiddleware",
"mezzanine.core.middleware.RedirectFallbackMiddleware",
"mezzanine.core.middleware.TemplateForDeviceMiddleware",
"mezzanine.core.middleware.TemplateForHostMiddleware",
"mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
"mezzanine.core.middleware.SitePermissionMiddleware",
Uncomment the following if using any of the SSL settings:
"mezzanine.core.middleware.SSLRedirectMiddleware",
"mezzanine.pages.middleware.PageMiddleware", .... ```` - Add some INSTALLED_APPS that Mezzanine is expecting:
.... "mezzanine.boot", "mezzanine.conf", "mezzanine.core", "mezzanine.generic", "mezzanine.blog", "mezzanine.forms", "mezzanine.pages", "mezzanine.galleries", "mezzanine.twitter", .... - Add references to the template folders of 
mezzanineto yourTEMPLATE_DIRStupleos.path.join(BASE_PARENT, '<path to mezzanine>/mezzanine/mezzanine'), os.path.join(BASE_PARENT, '<path to mezzanine>/mezzanine/mezzanine/blog/templates'), - Finally, if your like me, you'll have to override some of the 
extendspaths in the mezzanine templates, the most obvious being in "blog_post_list.html" which just extendsbase.html, instead you want it to extend the mezzanine specificbasefile. So go to that file and replace the{% extends "base.html" %}with{% extends "core/templates/base.html" %}. 
- 
                    Hi, I get this problem when running setup.py: `from: can't read /var/mail/setuptools from: can't read /var/mail/shutil from: can't read /var/mail/mezzanine ./setup.py: line 9: exclude: command not found ./setup.py: line 10: mezzanine/project_template/project_name/local_settings.py]: No such file or directory ./setup.py: line 13: syntax error near unexpected token (' ./setup.py: line 13: exclude = dict([(e, None) for e in exclude])'` any ideas? – vabada May 05 '16 at 14:57
 - 
                    the above content looks really helpful, but before i spend a bunch of time trying them out, are there any updated steps? i only ask because the answer was posted over three years ago, so i'm not sure how current it is. – Deven May 28 '18 at 05:22
 
5
            
            
        This is covered in the FAQs:
TLDR: Mezzanine adds a handful of settings, apps, middleware and context processors, all defined in its default settings.py file - you just need to extract enough of those, depending on your needs.
        Steve
        
- 1,726
 - 10
 - 16