Sourcing Markdown files instead of a Database

I want to use Django to built a docs site. The reason I want to use django is that I will need to implement Authentication, and I love how easy it is to do with django-allauth.

I also want this site to be open source, where people can contribute to documentation.

With this in mind is there anyway to source .md files, instead of a database?

Or both - you could store the .md text in the database, giving you all the goodness available there.

But regardless of the source of the text (database or file), you can render markdown to HTML in your view, and include that html fragment in your template.

Check out some of your options over at Django Packages to get some ideas.

Ken

I don’t see how will people be able to contribute to those .md files. The scanario I am looking for is:

  1. My site is open-sourced on Github
  2. Someone who noticed the error in the documentation, can create a PR with corrections.
  3. I review, and merge.
  4. Site automatically is updated.

Yout suggestion is to have both, which I like, but what I am looking for is how to automatically update the database with updates from that PR.

I guess, I could do this with Github Actions, but I was wondering if there is a more native way of reading .md files.

Views are just Python code run as a response to an http request. Your view can read files directly, just as if you were running this code outside of Django - there’s nothing special needing to be done.

1 Like

I got it! Thanks for the help.