Using Fancy HTML Templates In Django - Python Django Dentist Website #4
Вставка
- Опубліковано 5 вер 2024
- In this video I'll show you how to use pre-made HTML template files in Django.
Let's face it...no one writes their own HTML or CSS anymore. They just find a free or cheap template and tweak it to suit their needs. How do you do that in Django? That's what I'll show you in this video.
We'll search for free dental website templates, find one we like, download it, and install it into our Django project.
I'll show you how to create a static directory in your Django project, and how to tweak your settings.py file to reflect that static directory. Then we'll look at the 'load static' tag and individual static tags for our html file.
▶️ Watch Entire Money Making Playlist ✅ Subscribe To My UA-cam Channel:
bit.ly/2tEBTzg bit.ly/2IGzvOR
▶️ See More At: ✅ Join My Facebook Group:
Codemy.com bit.ly/2GFmOBz
▶️ Learn to Code at Codemy.com
Take $30 off with coupon code: youtube1
HTML TEMPLATE DOWNLOAD: colorlib.com/wp/template/dento/
@Up Web No sorry. The template is irrelevant...use any free template.
@Just Python did you find a free one??
Just found this - there's an easier way to convert all of the href= to {% static %}.
pip install djangify
navigate to directory with the html file.
djangify -d
You'll then get a new folder with the html files with all the references converted.
Ah you also then need to do a find and replace: [static '] with: [static 'website/] or [static 'appname/]. Works like a charm
thanks man that really helped!
Thanks, that works for me, really helpful!~
really really helpful. thanks!
man every time i forget the code come see your video again and learn more things
Nice!
Thank you! This is great content. I can't believe I didn't think to google free templates for dentist sites (or anything).
Not sure if this man's the only guy on this channel, but if he ain't, you guys at Codemy better get this man a medal. Just 40~ish seconds into the video and I had to subscribe! Sounds like this will be a fun, informative ride :)
Hey thanks..yeah I own codemy, it's just me.
Thank you so much for the value give.
- Quick note for my django static to work. (August 2020)
Use this format
STATICFILES_DIRS = [
BASE_DIR/"static"
]
not this one.
STATICFILES_DIRS=[
os.path.join(BASE_DIR,'/static/'),
]
or you can use the old code, but at the top of settings.py add: import os
you are the best !!!!
Hey Man!! , I was desperately searching out the template utility in django, after long search I came here and WOW you cleared all my doubts.
Superb Bro!!!! With Lots of Love from INDIA :)
Glad I could help!
You look exactly like Mr. White, from "breaking bad" 😄. and I'm ur big fan man, thank you so much for all this free knowledge for beginners !! lots of love from India 💙💙💙💙💙💙
Ha!
now, in 2022 please add {% load static %} under
That's always been the case.
Benzini shellden pythonu kelden alacan agaaa...
Whoa! This is GOLD. Thank you so much sir.
You're very welcome!
I really like your teaching style, heading to your website to buy this course
Awesome, thank you!
Thanks a lot man you dont know how long i search for this and didnt find any good like u tnx
Happy to help!
I discovered your channel today John and I suscribed immediately and put thumb up at each video I liked.
Moreover, I share your useful content with my network.
Thanks! I appreciate the support!
Quick question, would like to know why people go through the stress of building a simple dental website from scratch when it can be done with wordpress, elementor and a few plugins with little coding effort?
lol
You are on the wrong channel mate.
He is explaining so well, so glad I'm following him.
I also do have an off-topic question for the community : does anyone have that dento template, I cannot find it ? Thank you xD
Yeah it's not free anymore...but who cares? Use any free template. The point isn't to build a dental wenbsite...but any website with a template. Go find something else for free. Or my github is: github.com/flatplanet/dentistDjango you can hand grab each of the files there if you just really want to...
@@Codemycom Yes, you are right. It's just my roommate is close finishing medschool and I really want to surprise him with an website like this. Thank you again for you support and please keep doing the great work !
give this guy a thousands likes,cmon he is the best
Thanks!
Excellent !! Very articulate, clear and easy to follow.
Thanks!
Great video again!
did you ever try to automatice (maybe with an find and replace command or an script??) the process of updating the links to images and others? there should be a way to avoid the step
How do i render the static css if my page contents no href tags at all?
Hi, do we need to modify the css files as well? I did everything you showed here in the video and not even one css element loads in the home page...its just basic html with text only...Has css and html changed since 2020 when you made this video?
have you solve this? if not, maybe you can search "Django static files" in UA-cam.
Your approach of your channel is original and very useful for me.
How many video need to be released to do complete the tutorial ?
Useful content by the way thanks :)
Thanks! Glad you're enjoying the videos! I have no idea how many videos will be in this series...I'll keep going till the project is finished. I haven't filmed them all yet.
Wow, if your haven't filmed yet you're very efficient.
It's the first time I see someone who put this amount of content regularly.
Me and my friends are impatient to learn your tricks.
@@ryan_0337 It's my full time job :-P
Good news
Hey man, thanks so much !!! you explain clearly and funny , i was looking this information everywhere
Glad you found it!
I suppose it may not be possible with the development server, but it seems like it would just be easier with nginx/apache or whatever the server ends up being to re-route all of the static content straight to the proper folders, if you're going to be bringing in existing sites like this.
This is a trivial example, but:
server {
listen 80;
root /django-home/ ;
location /{
include uwsgi_params;
uwsgi_pass unix:///tmp/uwsgi.sock;
}
location /static {}
}
How is that easier?
16:15 why even call it home though if it's standard to call it index?
It's standard to call it home in django
Good stuff. Kinda funny you explain basic windows usage though.
Only to you, because you know it already
nice tutorial seen ever, very helpful for beginners.
Glad you think so!
0:28 make sure to smash the like button with your bald head.
.
.
.
.
.
.
.
jokes apart! great tutorials.
Ha
thank you very much , very helpfull . the kind of content that saves my butt . thumbs up
Great tutorial sir ❤️❤️❤️
Thanks! Glad you're enjoying them!
You are the greatest
Thanks!
Thank you. very informative video :)
BASE_DIR / 'static' can also be used in ubuntu
hey!! it's really really helpful for me thank you so much....
Most welcome!
Are you planning to explain how we can deploy the app ?
Most definitely
Thank you very much!)
Sure thing!
I have actually used pycharm instead or visual studio ..I don't know why I still had a error of not found files while inspect the website ......I have used {% static 'path'% }
There are reasons I don't use pycharm or visual studio
How to use audio tags with django? I have tried but they don't seem to work
My settings.py file has 'from pathlib import Path' / 'BASE-DIR = Path(__file__).resolve().parent.parent' rather than 'import os' / 'os.path...'
At the top of the file, add: import os
17:23 my static tag will be same or different, I have php file, ie home.php
nice man very nice
Thanks!
Thankyou sir It's help me so much
Happy to hear
Is there any faster way to do this cause like its gonna take me soooo long i have a lot of html files
No
style.css - I'm getting the error. Help please :(
What error?
@@Codemycom solved it . thanks :)
Sir can you share setting.py code and home.html code .. I was work in Django 1 year . Hope that is very good tutorial .
I want to learn from here more ..
Please help and give me a chance to do something...
I am working in PyCharm professional (and enabled django in settings) but it won't recognize my {% load static %} tag... Anyone encountered and fixed this issue?
Yet another reason why I'd never use Pycharm.
I've just come across Djangify which will do all the re-referencing work for you. Do you recommend this? Cheers and thanks from Sydney, Aust - Dave
I'm not familiar with it
I have tried it and it works like magic but it has few issues like but I think it reduces 90 percent of editing
Hey sir, can I still download the templates the you've used for free or not anymore?
I have created a home page but today I have a problem .please help me fix this ('Static' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz
)
Your Channel has helped me to master Django .Thanks for Making my life easy!
it should be static (lowercase), not Static
very good vedio
Thanks
Hi, Thank you for your sharing. I follow your solution and it work! but I still have some problem that I can't change any background or color of free template from .css file. Could you suggest me pls?
You should be able to do it without a problem
smart one
colorlib is no longer free?
Looks like it
After making all the edits in the index.html file I am still facing these 3 errors:
1) "GET 127.0.0.1:8000/static/js/owl.carousel.min.js net::ERR_ABORTED 404 (Not Found)" ----These type of error in whole page for css and img links(GET 127.0.0.1:8000/static/img/language.png )
2) "DevTools failed to load SourceMap: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/_handler.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME" and
3) "VM531:12 Uncaught TypeError: this.remove is not a function
at :12:14"
I have spent so much on time to understand the error but unable to do. Please help me here
Sorry man, I have no idea what you've done. You shouldn't be having such errors. Maybe you need to scrap the whole thing and just start over, rewatch the videos and pay closer attention as you work...The code must be exact. Indentation exact, capitalization exact, quotation marks and punctuation exact, everywhere.
Thank you for the reply, I'll retry and let you know the results.
Hi, I have tried multiple times and figure out the issue, Thank you for the support. :-)
Sir please solve the issue..
Css not work ..
Django 2.1.5
If you want to see my code then I will show in comments box.
Please help me with the link to the source code because colorlib are selling this template
github.com/flatplanet
Hello thanks for the tuts, The Dento template is now for sell is there another way i can get it ?
Use any free template you like. The procedure is the same.
thank u so much but how i fix this error
"TemplateSyntaxError at / nvalid block tag on line 12: 'static'"
There's an error with your static tag code... on line 12
Hi! I followed u step by step but still have problems with css .What do u suggest me to try next ? Images cant be open and they are all like in html page ,I mean not styled.
Retrace your steps to determine what you did wrong.
@@Codemycom I saw it again and again .When I click images to open it says that files has been moved or deleted but files are there inside of static files😲
@@besjancoku196 check the static code in your settings.py file for errors
Hey! Can you please provide this template in a drive link?It would be really helpful
How do i render the static css if my page contents no href tags at all?
you dont
Thank u so much
You're very welcome!
thankyou its very useful
You're welcome!
hello again sir
when i add {% static 'website/'%} to the home.html it doesn't looks like the original website
i see the menu in left side of the home page and when also when i clicked contact it was the same (
Pages
- Home
- About Us
- Service
- Pricing
- Blog
- Blog Details
- Contact
- Dropdown
- Dropdown Item
- Dropdown Item
- Even Dropdown
- Even Dropdown
- Even Dropdown
- Even Dropdown
- Dropdown Item
- Dropdown Item
About)
all of them in left side of page ! can you help me sir?
Rewatch the video... you don't use {% static 'website/'%} you have to add the thing to the end of it...so for css it would be {% static 'website/css/style.css' %} and you have to go through the entire page and add those tags for every image, css file, and javascript file. Watch the video again.
Hey man your tutorials are really good ,but when I am using the static tag ( "{% static ' address of image' %}" ) for images I can see the web side but I can't see the images on my web side can you tell me why?? Instead I can only see a default image
You have an error in your code, or your static directory is in the wrong place, or you messed up the settings.py static thing.
@@Codemycom thank you for your response and I got where I was going wrong.
@@mithilsingh2906 hey i think i have the same problem can you help me in what was the solution to that problem?
Hey! so all of my static files are working fine but it seems when i do the background urls it messes up and my folder turns red indicating problem. this is how it looks style="background-image: url({% static 'website/img/bg-img/1.jpg' %});"> the png files and js/css etc are working fine it seems to be only this
so update... i was using vscode and it shows red folders but with sublime text it doesnt show error. Kinda wondering why its doing that :l
because vscode sucks
In any way, I understand today how to choose files from a new template in static folder. I will now look at what the html file and (of the actual template) are basically set up to and "redirect" it as the static manner.
I followed all the steps, but not work with me i did it 3 time
The error message😢😢
not found: /{% static 'website/css/style.css %'}
The css file not work 💔☹️
you have a quotation mark in the wrong place at the end of your static tag
{% static 'website/css/style.css %'}
Thank you for such helpful tutorial. I created app on windows and it worked completely fine. But on Linux, for all the resources I am getting 404 error on console. The website does load, but its not able to find static data like CSS, images, JS. Is there any other changes on linux we need to do. I did echo $BASE_DIR but I got an empty response.
It should work fine. Did you install the virtual environment and all dependencies etc?
@@Codemycom Yes, I did followed same steps. Like installing python, django, created virtual environment. Making changes in settings.py and other files. But still the static resources are not able to load and at console I see 404 error. Is it anything related to AWS ? I have whitelisted ports though.
Update: Seems there was issue with virtual environment and now it's working perfectly fine. Once again thank you so much for sharing this knowledge. Good luck John 👍
@@swapnilshrishrimal4520 I have the same problem, how did you fix it?
@@swapnilshrishrimal4520 what was the issue?
Hey. Could I make a website with HTML, CSS, and Django? Without learning JavaSript.
Of course. I rarely use JS for anything...
Hi bro
I tried the way you showed but still the images not show in website
also on settings.py
the system not import os
just there " from pathlib import path "
also BASE_DIR which I have is like this " DASE_DIR = Path(__file__).resolve().parent.parent"
it is okay I just fixed
I really dont know how
@@Stubbornfighter2012 just add: import os to the top of settings.py
Thanks teacher
Welcome
Hi, can you make an example django with metronic htlm theme
No sorry, I don't know metronic
Unable to download the template 😢😢😢 now it not having the download button. There is only preview button available. 😭😭
The template is irrelevant...go find any free template.
@@Codemycom okk. Thnk you
Why not paste all the files in templates folder of app and save the pain of editing.
You'd still have to edit them...and is it really a pain? lol
10:45 .. I'm sorry boss.. but should I name the two folders exactly the same names? for example if I named my app "AppleApp" should I naming the folder under static "AppleApp" also? thanks
You can do whatever you want
@@Codemycom last thing.. after I do everything as you say... the website give me a white/blank page without any error and when i move the cursor arounf the page i see that i can click on buttons, lists..etc but without seeing anything?? you have any solutions?
@@x3bDulaZizAK No idea...you did something differently than the video but I can't guess what.
@@Codemycomdo you have tech support on codeacademy? cause i need someone see the problem for me... thanks
@@x3bDulaZizAK Yes, for courses on codemy.com
Hello, this is an amazing video... Thank you for this. At the time this video was made the template on colorlib was free, but now i am asked to pay for it. Please if you have the template file, could you send it for me.
The template is sort of irrelevant, isn't it? Use any free template you can find or like.
actually I have a website with 214 pages and I wanna use Django but u know many pages means many images/css/js files so it will be sooooo slow changing everything manually, is there any way to do it quickly?
actually I was trying to add just a contact form using Django but as I learnt more about python I decided to move everything to Django, however is it necessary to do that (changing everything to a Django project and change static files etc) to get a contact form with Django?
No, that's not the case at all, and has nothing to do with django.
yes
@@Codemycom Ok thank u so much for your efforts.
17:01 Thought the video restarted 💀💀💀
the dentist template does not seem to be free any more
Nope...sucks. You'll have to search for a different free oner. The concepts are all the same tho...
@@Codemycom Will do. Thanks
Lots of the follower face same problem. Sir please help css not work
You can create an short note why create that problem
It's one of 3 things. Either you didn't put the static folder in the right place, you messed up the static dirs code in settings.py, or your static tags are wrong. Also, if you're using django 3.1 or above, you need to add the line: import os to the top of settings.py
Django 2.1.5
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
Sir I was following you more then 10 time ..
Css file not working..
the template isnt free anymore :/
you can find it on my github or use any template...the template is irrelevant
Hi john i can't download these templates in colorlib because it's not free .can u give any suggestions please
download some other template
@@neuron8186 yeah thanks bro
i dont find any free similar template, can you please help@@Balaji-hq9jm
hello love your videos i'm having an issue downloading the templates i have no download option just the preview option and then options to buy things please help.
Yeah they recently switched that theme to paid...you'll have to find some other free template. The concepts in the video are the same no matter what template you use
@@Codemycom i have searched but i cant find any free templates out there
@@bhushanparab3641 lol there are millions. search better. Type: free html template into google
@@Codemycom ok thanks, I'll search deeper.
It’s good but really annoying how this is already out of date, django has updated and os.path.join has been replaced with BASE_DIR / subdir.
I had to downgrade to get it to work this this way
welcome to coding. You can simply add this line to the top of your settings.py file and it works fine:
import os
No need to downgrade
@@Codemycom thanks for replying really fast, no worries, i sorted it out
@@crazyjay235 good
@@Codemycom soz, i know this works cos ive done it with a prior template, i'm putting in {% load static %} and then the tag {% static 'website/' %} to convert the css to make it pretty,,
it's coming up with this error:
could not parse the remainder: '‘website/img/core-img/favicon.ico’' from '‘website/img/core-img/favicon.ico’'
Would appreciate the help massively
Don't worry i sorted it.... u won't believe the bullshittery i went through....
template link themeslab.org/html/dento
maaaan u are the best!
I am on a mission to like all your videos!!!.... also i am not able to find any free templates..... can u help?
Awesome! Sorry no, you'll have to just google it
Thanks
Welcome!
How do I view PPT files on the website using the Django framework?
what do you mean? View the actual powerpoint slid on a webpage? Or download a powerpoint presentation from a website?
@@Codemycom I want to view the actual ppt slide on the website.
@@anshitmishra Is that even possible? I don't know about ppt stuff
@@Codemycom I am also searching about it. But thank you for your reply 🙏❤.
template is behind a paywall now.
The template is irrelevant...use any one you want from anywhere.
Please make an ecommerce website using django
Might just do that eventually
thank you.
You're welcome
When did Walter White quit and learned to code Python?
lol
Thanks)
Sure thing!
the template you used is not free
They recently started charging for it. But just use any other free template you find...the concepts are the same
My man lost me when he said I had to do copy and paste {% static ' ' %} to every file in the index
because...clicking a couple of buttons is hard? LMAO