Building a Markdown-based CMS Inside your Pyramid Web App Course

Course Summary

Are you deciding whether to build a Python web app in Pyramid or go with a CMS like Wordpress? This can seem like an either/or decision. Either, you can have a great data-driven web app or some clunky PHP thing that marketing and other folks can use to create the site.

But as you'll learn in this course, it's quite easy to add a powerful CMS to your existing web app!

What students are saying

I’ve yet to ever be disappointed with a Talk Python course!
-- Ibrahim G.

Source code and course GitHub repository

github.com/talkpython/adding-a-cms-to-your-web-app-course

What's this course about and how is it different?

This unique course shows you how to leverage your existing skills in your Python web framework and the huge investment you have made in building a scalable application on the web to add a user-friendly, high-performance CMS capability right on top of that app. You can add these features without modifying your existing site's behavior or (besides startup) the existing code.

If you have wished you could simply sign in to your site and add new functionality, pages, redirects, and more but have scoffed at adding a separate CMS like app layer on the side, this is for you.

We treat you as knowledgeable Pyramid developers who need to add this cool functionality to empower your team to do more on their own with your site.

We will start from first principles of routing, views, and templates to help you have full control over this CMS functionality, just like you have for the rest of your web app.

Flask or Pyramid web framework?

This course comes in two flavors. Pick the one that makes you happy:

Get the CMS + Web Foundations Bundle

Both courses with CMS Web Bundle

We created a special bundle of courses including the foundation web course as well as this CMS course in two web frameworks, Pyramid and Flask. Check it out and get two for the price of one.

What topics are covered

In this course, you will:

  • Learn how to have data-driven pages and CMS pages coexist in your app
  • Add CMS pages to your existing website or a new website you're just launching
  • AVOID running a parallel WordPress or Joomla site for this CMS-like functionality
  • Take full advantage of the capabilities of your site while working with landing pages and other CMS elements
  • Allow marketing teams, business teams, and others to edit site safely and professionally
  • Employ the markdown-subtemplate package for extreme performance
  • Use markdown-subtemplate's content reuse features for creating shared elements across pages
  • Write markdown content and render rich HTML
  • Use a proper, full-featured markdown editor on your admin backend for a professional and polished experience for your internal users
  • Add the CMS superpower to your web app
  • And lots more

View the full course outline.

Who is this course for?

This course is for anyone who has or is creating a Pyramid web application and would like a much better way to fully round out the content of the site.

Yes, every web app will need some data-driven elements. If you ran a book store, there would be a page showing the book details: cover, title, price, summary, etc. But you would also have a contact us page, a privacy policy page, a landing page for a marketing campaign, and on and on. If you want to create all that other content without writing new code and redeploying the site, then this course is for you.

As far as knowledge prerequisites, we assume that anyone taking this course has basic knowledge of:

  • Python (you can write a function, create a class, reuse elements via import)
  • Pyramid
  • HTML and CSS

What will we build?

In this course, we take an existing web application and add this CMS capability to it. We will start with a clone of the PyPI website (pypi.org) written in Pyramid.

Then we will systematically add our CMS features to that application. We will add the ability to have arbitrary redirects in the URL structure (think bit.ly) *as well as *full pages (think WordPress). Once we can capture and render these, we will add a deep admin section with a proper markdown editor and other capabilities to the app.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can mean losing the forest for the trees. That's why when we hit a new topic, we stop and discuss it with concise and clear visuals.

Here's an example of how routing works and a given URL is mapped to an appropriate view method.

Example: Concepts backed by concise visuals

Get hands-on for almost every chapter

Learning to code is an interactive experience. That's why it's important to write code and explore the apps we are building during this course.

Each chapter has code for the app as it began and as it finished. You are encouraged to follow along and create the relevant part of the CMS features after each chapter. You can start with the same code we do in the course and if you ever get lost, "reset" your progress by jumping in at that chapter.

Here's the GitHub repo structure that you can explore now to see what we're talking about.

Example: Code snapshotted at each chapter

This course is delivered in very high resolution

Example of 1440p high res video

This course is delivered in 1440p (4x the pixels as 720p). When you're watching the videos for this course, it will feel like you're sitting next to the instructor looking at their screen.

Every little detail, menu item, and icon is clear and crisp. Watch the introductory video at the top of this page to see an example.

Follow along with subtitles and transcripts

Each course comes with subtitles and full transcripts. The transcripts are available as a separate searchable page for each lecture. They also are available in course-wide search results to help you find just the right lecture.

Each course has subtitles available in the video player.

Who am I? Why should you take my course?

Who is Michael Kennedy?

My name is Michael, nice to meet you. ;) There are a couple of reasons I'm especially qualified to teach you Python.

 1. I'm the host of the #1 podcast on Python called Talk Python To Me. Over there, I've interviewed many of the leaders and creators in the Python community. I bring that perspective to all the courses I create.

 2. I've been a professional software trainer for over 10 years. I have taught literally thousands of professional developers in hundreds of courses throughout the world.

 3. Students have loved my courses. Here are just a few quotes from past students of mine.

"Michael is super knowledgeable, loves his craft, and he conveys it all well. I would highly recommend his training class anytime." - Robert F.
"Michael is simply an outstanding instructor." - Kevin R.
"Michael was an encyclopedia for the deep inner workings of Python. Very impressive." - Neal L.

Free office hours keep you from getting stuck

One of the challenges of self-paced online learning is getting stuck. It can be hard to get the help you need to get unstuck.

That's why at Talk Python Training, we offer live, online office hours. You drop in and join a group of fellow students to chat about your course progress and see solutions via screen sharing.

Just visit your account page to see the upcoming office hour schedule.

The time to act is now

On the internet, content is king. You interact with customers and rank in search engines based on the pages on your site. Take this course and you'll have the most tightly integrated experience for quickly adding content to your app. Your users will not be able to tell the difference between the CMS side and the structured side of your app.

Join this course today! You've got nothing to lose. Every one of our courses comes with a 2-week money-back guarantee.

BTW, this page, along with many others on our site, was created with exactly this technique which we have extracted into a framework for this course. ;)

Course Outline: Chapters and Lectures

Welcome to the course
11:16
Welcome to the course
4:32
What we'll cover
4:38
Student expectations
1:26
Meet your instructor
0:40
Course setup and requirements
5:27
Get the right Python version
2:05
Our code editor
2:16
git the source code
1:06
A tour of our demo application
14:09
A tour of our demo app
2:28
Exploring the starter source code
5:35
Getting the app up and running
6:06
Routing for the CMS
28:46
What is routing
3:03
Routing examples
4:09
Examining the existing routes
4:06
Adding THE cms route
6:57
The cms_service
4:34
Concept: Adding the cms route
1:40
A better 404 error page
4:17
Redirects and the admin section
1:13:52
Introduction to redirects
1:42
Demo: Adding a redirect
4:51
Keeping the query string for redirects
5:49
Concept: Doing a redirect
1:11
Concept: Viewmodels
2:02
Demo: Creating the CMS viewmodel
5:26
Adding the admin backend
1:20
Demo: Admin section
7:11
Cleaner permission checks
4:09
Listing the redirects
7:12
Concept: GET-POST-Redirect flow
2:29
Add redirect view methods
2:10
Adding redirects HTML form
6:05
Pulling data from the form
3:03
Creating the redirect in our simple DB
2:11
Editing an existing redirect
4:01
Loading initial values in viewmodel
6:01
Cleaning up short urls
1:01
Cleaning up the html: Add vs. Edit
2:15
Remove the code duplication for Add vs. Edit
3:43
The Pages
33:22
Difference between CMS vs data-driven pages
3:39
Rendering the page within our site template
5:25
Real page content (i.e. HTML)
4:20
Concept: Real page content
1:41
Admin: Listing pages
3:49
Adding a CMS page
10:20
Editing CMS pages
4:08
Saving content to a database
37:06
Introducing SQLAlchemy
1:06
Do you need to learn SQLAlchemy?
1:36
A tour of the existing DB layer
3:22
Creating the Page SQLAlchemy class
5:14
Creating the Redirect SQLAlchemy class
2:48
Inserting a redirect
6:03
Using the new redirect class in our app
6:15
Saving a page to the DB
4:13
Using pages from the DB
4:15
Concept: Inserting data
0:56
Concept: Query for a CMS object
1:18
Markdown: A better format than HTML
16:37
The problem with HTML
3:18
Adding markdown content
2:33
Oops, we broke our edit moving to DB
2:04
Converting markdown to HTML
6:36
Extras in the markdown format
1:18
Concept: Rendering markdown
0:48
A rich editing experience
14:01
Choosing a markdown editor
1:55
Installing SimpleMDE
2:53
Concept: Installing SimpleMDE
1:43
Using SimpleMDE
5:48
Concept: Using SimpleMDE
1:42
Advanced Markdown templates
33:08
Shorting comings of pure markdown
4:22
markdown-subtemplates
2:17
Using markdown-subtemplate in the viewmodel
1:55
Custom storage-engine (DB)
6:46
Using shared-content, first pass
2:58
Formatted elements
3:32
Marking pages as shared (DB level)
3:59
Marking pages as shared (editor level)
7:19
Logging user and system activity
18:55
Logging motivation
1:46
Current logging with LogBook
1:02
Demo: A tour of the existing logging
5:39
Markdown log levels
2:59
Integration markdown-subtemplate and LogBook
5:38
Concept: Setting markdown log levels
0:52
Concept: logger integration
0:59
Course conclusion
19:47
You've done it!
1:35
Review: CMS routing
3:34
Review: Redirects
1:01
Review: ViewModels
1:37
Review: Data-driven vs. CMS pages
2:18
Review: Rendering a CMS page
1:33
Review: Inserting with SQLAlchemy
0:56
Review: problem with HTML
1:34
Review: Improving markdown
2:33
Review: Logging
1:54
Thanks and goodbye
1:12
Appendix: Modeling data with SQLAlchemy classes
49:47
Introducing SQLAlchemy
4:07
Who uses SQLAlchemy?
1:35
Architecture
2:14
The database model
3:10
Modeling packages
6:50
SQLAlchemy model base class
1:56
Connecting to our 'database'
4:20
Creating tables
7:09
Indexes
4:01
The rest of the tables
3:35
Relationships
6:35
Concepts: Modeling
4:15
Appendix: Using SQLAchemy
50:34
Inserting data
8:18
Inserting the actual data
3:52
Concept: Unit of work
2:26
Querying data: Home page
5:02
Querying data: Latest releases
6:12
Working with package details
2:10
Package details data
6:43
Performance and lazy or eager loading
7:07
Concept: Querying data
4:03
Concept: Ordering data
0:44
Concept: Database updates
0:49
Concept: Relationships
1:59
Concept: Inserting data
0:37
Get the full SQLAlchemy story
0:32
Buy for $49 + tax Bundle and save 85% Team Gift

Questions? Send us an email: contact@talkpython.fm

Talk Python's Mastodon Michael Kennedy's Mastodon