# Sourcing Markdown files instead of a Database

**URL:** <https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959>\
**Category:** Using Django\
**Created:** [August 18, 2020, 7:28pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959 "2020-08-18T19:28:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasulkireev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rasulkireev/32/1151_2.png) [@rasulkireev](https://forum.djangoproject.com/u/rasulkireev)\
**Post date:** [August 18, 2020, 7:28pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959/1 "2020-08-18T19:28:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 18, 2020, 8:19pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959/2 "2020-08-18T20:19:43Z")

</div>

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](https://djangopackages.org/search/?q=markdown) to get some ideas.

Ken

---

<div class="post-metadata">

**Author:** ![rasulkireev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rasulkireev/32/1151_2.png) [@rasulkireev](https://forum.djangoproject.com/u/rasulkireev)\
**Post date:** [August 18, 2020, 9:15pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959/3 "2020-08-18T21:15:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 18, 2020, 9:48pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959/4 "2020-08-18T21:48:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rasulkireev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rasulkireev/32/1151_2.png) [@rasulkireev](https://forum.djangoproject.com/u/rasulkireev)\
**Post date:** [August 18, 2020, 10:10pm UTC](https://forum.djangoproject.com/t/sourcing-markdown-files-instead-of-a-database/3959/5 "2020-08-18T22:10:57Z")

</div>

I got it! Thanks for the help.
