Django Markdown Tutorial - A Simple Blog Example | Django/Python Project
HTML-код
- Опубликовано: 16 сен 2024
- Learn how to use Markdown in your Django blog posts or other places on your website.
In this tutorial, I build a very simple blog where I make it possible to use Markdown in the blog post content.
Markdown is a way to write readable content that can be converted to HTML and similar.
In this Django tutorial, I will use a Python package called "markdown" to do the magic for us. This Python package will convert Markdown to HTML.
To show the HTML safely in our blog, we use a Django filter called "safe".
---
Important links
GitHub: github.com/Ste...
Discord: / discord
Patreon: / codewithstein
Twitter: / codewithstein
Website: codewithstein.com
---
#codewithstein #django #python #markdown #blog #learndjango
Your channel is a goldmine and since i am not at the level of being a patreon supporter... I just watch all the RUclips ad's and leave a like... Thanks Stein.. You are awesome.❤️
Thanks 😁😁 watching ads and liking videos is great 😁 RUclips loves when people do this, so it is good for my channels growth 👍🏻
Same here bro, this man is a legend. No bullsh, no minutes long self promotions, no time waste. Just straightforward coding. Thank you so much, Stein!
Thanks 😁😁
your tutorial is amazing and quite quick to start!
Thank you 😁
Excellent tutorials. I am newbie Django learner. Thank you for making this tut!
Thank you so much! I'm glad you liked it :-D
Thank You stein
You’re welcome 😁
The training was very smooth and excellent
Thank you, good luck
Thank you 😁😁
Thank you so much, you explain so well
Thanks 😁
Thank you, so much! Now it is super easy for me to implement it!
Great 😁
I was looking for that lots of time
Nice :-D
Thank you!
You're welcome :-D
I was just looking for something like this!
Cool :-D
Awesome thank you 😊
You’re welcome 😁😁
ahhhhh.......Hats off to You! I got it all in my mind In One video, but I have a question and that is how to enable syntax highlighting on the code block that is shown in the frontend, and also another question that from the frontend can we import a library like such for syntax highlighting, or should we do it from backend
Hi, Thanks 😁 there are several libraries for this using javascript and Css. Not 100% sure of the names, but try to Google markdown code block highligth or similar ☺️
Thanks bro. Tried using regular expressions for the conversion, but it was way too complicated.
Yes, i can see that ☺️
Men thanks, excelent video!!
Thanks :-D
Thanks a lot :D
You're welcome :-D
i am unable to insert images with this method between my text on the website. A lot of markdown features are also not working. Someone please help.
Thanks for the tutorial. I set my blog up basically the same way, but I have an issue that I can't resolve. My first code block works great, I'm using codehilite and all the coloring and stuff looks good. The second code block and any subsequent blocks aren't being stylized and some characters have red err squares around them, and when I look at the inspector tools, those characters have around them. ex. # for a comment. I'm assuming there is some syntax error either in the first code block or something in the HTML.
Hmm that is weird :/ have you checked my code on GitHub to see if you have any typos?
@@CodeWithStein I'm not sure what the issue was. I gave up on it and tried django-summernote. I was able to get the results I wanted with it. I appreciate the response!
Great ☺️
Great video
Thank you 😁
Great!
That's exactly what I was searching for!
Is it possible to create the blog posts by uploading markdown files to the django project (as static files?) which will be converted to html on `collectstatic` - to be displayed in HTML on the final blog page?
This would give me the opportunity to write blog posts in markdown, just upload the files and download them them as needed if I want to edit something.
Hey! It's probably possible, but I have never tried it so I can't help you :-S
You don't need the static files to do that.. Just copy the markdown from your editor into the admin content text editor and save it.. That is the simplest solution to it.. That is what I do anyways, because the admin text editor is kind of wonky to use.
Also, I imagine it would be more efficient and less costly to generate the files as a user needs them. This way your server isn't storing the data multiple times, in the database and also as a static file.
Excuse me, which plugins are you using for vscode?
Hey, not too many. Vetur, Pylance and Python. I think I made this video on my previous mac, so I don't have the exact list anymore :-s
👍
☺️
How would you upload / display a image for your blog post using Markdown? Would Django know where to look for the image when it renders the template on the server?
You can't upload it through Markdown, but if you have it on the server, you can show it like this:
![alt text](/media/django-sign-up-1.jpg "Django Sign Up Page")
Hi, How can we make that code block copyable anyone has any idea on it ?
Hey, you need to use a javascript snippet to copy it to the clip-board. If you google this, you will find it :-D
Hi Stein! It would be nice if you can include Docker as well for your apps!
Hi, I’m working on a little tutorial video for Docker with Django + Postgresql 😉
@@CodeWithStein nice! Looking forward to it!
@@CodeWithStein because I don’t quite know how to do Docker yet lol….It'd be nice if you can do a web app that involves this too!
I’ll pay you more after that 🤣🤣
thanks
You’re welcome 😁😁
How insert images?
Hmm, not done that in markdown before :/ Have you tried googling it?
Hi Stein. Please make a django admin dashboard from scratch. There is no video on RUclips showing how to build django admin dashboard from scratch.
Hi!
I've been thinking about creating an advanced blog series. Here I want to create a "cms" or at least a custom place where you can login to manage the posts, comments and similar :-)
@@CodeWithStein Yes please. By the way thank you for your other tutorials. Learned a lot from you. Thank you!