Python wagtail Integrating into Django Project














































Python wagtail Integrating into Django Project



 In the previous article we have discuss about wagtail testing in which i have discuss what are the different type of method through which you can test your wagtail site.If you have not gone through it you see through this link wagtail test . In this article will start how we can Intregrate our wagtail page into Django project    

          Integrating Wagtail into a Django project

Wagtail provides the wagtail start command and project template to get you started with a new Wagtail project as quickly as possible, but it's easy to integrate Wagtail into an existing Django project .

Here are the list of step how you can Integrate wagtail into Django project

Step 1:- Installation

         First, install the wagtail package from PyPI:

  • $ pip install wagtail


Step 2:-  Settings

  •    In your settings file, add the following apps to INSTALLED_APPS:

'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',

'modelcluster',
'taggit',

  • Add the following entry to MIDDLEWARE:

'wagtail.contrib.redirects.middleware.RedirectMiddleware',

  • Add a STATIC_ROOT setting, if your project does not have one already:

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

  • Add MEDIA_ROOT and MEDIA_URL settings, if your project does not have these already:

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

  • Add a WAGTAIL_SITE_NAME - this will be displayed on the main dashboard of the Wagtail admin backend:

WAGTAIL_SITE_NAME = 'My Example Site'


Step 3:- URL configuration

Now make the following additions to your url.py file:

from django.urls import path, re_path, include

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

urlpatterns = [
...
re_path(r'^cms/', include(wagtailadmin_urls)),
re_path(r'^documents/', include(wagtaildocs_urls)),
re_path(r'^pages/', include(wagtail_urls)),
...
]


Step 4:-User accounts

Superuser accounts receive automatic access to the Wagtail admin interface; use ./manage.py createsuperuser if you don't already have one.


Step 5:- Start developing

You're now ready to add a new app to your Django project  and set up page models




More Articles of SAYENDEEP MAHANTY:

Name Views Likes
C++ Exception Handling-|| 72 3
C++ Exception Handling 102 3
C++ File Handling EOF 81 5
C++ File Handling Error Handling During file Operation 935 5
C++ File Handling seekp() Function 90 5
C++ File Handling seekg() Function 78 6
C++ File Handling tellg() Function 107 5
C++ File Handling tellp() Function 96 5
C++ File Handling close() Function 69 5
C++ File Handling:: open() 92 5
C++ File Handling Introduction 121 5
C++ Container Library:: std ::array-II 92 4
Top Django Interview Questions and Answers You Need to Know 264 6
C++ Container Library::std::array 85 6
C++ Container Library Introduction 94 5
Essential Engineering Skills for Your Resume 115 5
Mistakes To Avoid During Technical Interview 122 5
Mistakes You Must Avoid During Work From Home 164 6
Seven Common Mistakes that Beginners Should Avoid While Learning to Code 94 6
Simple Linear Regression 89 6
Python wagtailmenus 108 6
Python wagtail application 109 6
Python guppy GSL 119 5
Python wagtail guppy subpackage heapy 163 6
Python guppy Introduction 204 6
Python wagtail Structural Block 242 6
Python wagtail Integrating into Django Project 336 6
Python wagtail testing 265 7
Python wagtail Basic Block 315 7
Python wagtail image tag 209 7
Python wagtail Templates 167 6
Python wagtail Backends 187 6
Python wagtail Indexing 172 6
Python wagtail Search 166 7
Python wagtail Snippets 179 6
Python wagtail Writing your own page models 156 9
Python wagtail model class PageRevision 182 10
Python wagtail model class Site 191 9
Python wagtail wagtail core model 210 9
Python wagtail page models 180 10
Python wagtail 155 11

Comments