Change Website Homepage to Wagtail Blog Homepage
The Wagtail admin has a nicer and a more user-friendly interface compared to the default Django admin user interface. For this reason, we would rather use our Wagtail blog as our main blog and ignore the blog we created in the main tutorial.
We will not remove our initial blog, we will leave it as it is as we may need to use it for more learning. We will however change the root of our project to point to our Wagtail blog. Make the following changes to your mysite/urls.py as shown below:
First change the URL for your first blog to the following:
path('blog/', include('blog.urls')),Next change the URL for the Wagtail blog to the following:
path('', include(wagtail_urls)),Your mysite/urls.py should now look like below:
```python from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path
from wagtail.admin import urls as wagtailadmin_urls from wagtail import urls as wagtail_urls
urlpatterns = [ path('admin/', admin.site.urls), path('blog/', include('blog.urls')), path('cms/', include(wagtailadmin_urls)), path('', include(wagtail_urls)), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
This will make your Wagtail accessible by visiting `http://127.0.0.1:8000` as shown below

and your first blog will now be at `http://127.0.0.1:8000/blog/` as shown below.

# Committing our changes to GitHub
Now that we have managed to get Wagtail working well with out blog, we can deploy our changes to our live website
which we deployed to PythonAnywhere earlier on during the main tutorial. To do this, we need to first push our code to
GitHub as we have done before by typing the following in our command line:
(myvenv) ~/djangogirls$ git status
(myvenv) ~/djangogirls$ git add .
(myvenv) ~/djangogirls$ git commit -m "Add Wagtail to our blog"
(myvenv) ~/djangogirls$ git push origin HEAD
$ git pull origin HEAD
$ pip install -r requirements.txt
$ python manage.py migrate
$ python manage.py collectstatic
Last updated
Was this helpful?