Anonymous
Django 2.1
inchidi
Django 2.1
run this code in your django shell
from budget.models import Project
for project in Project.objects.all():
print(f"http://localhost:8000/{project.slug}")
it will print all urls which wont raise 404
Anonymous
Anonymous
http://localhost:8000/business-ventures
http://localhost:8000/akash-kandpal
Anonymous
these links are working
Anonymous
BTW why is that I can't pass anything as slug? and passing these things only, though I created them earlier as the project.name
Anonymous
?
inchidi
Anonymous
Hello everyone
Anonymous
I am new in this group,if someone has video tutorials of django, please share it with me.
Thank you
inchidi
Anonymous
Hello everyone
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK
Anonymous
Thanks a lot @Inchidi @harrypotter0
Anonymous
How much time would learning django celery for basic background task will take
Vikas
https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBlmzzFcLgDhKTTfNLfX1IK
Vikas
This is previous version of Django I want new version begginerz Django video plz send me a link g
Anonymous
Vikas
Okk g
inchidi
i found that using @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.MD5PasswordHasher']) in our unit test make a really big difference
Jose Luis
why updated = models.DateTimeField(blank=True, default=datetime.now) and updated = models.DateTimeField(blank=True, default=timezone.now)
Jose Luis
always save my local datetime instead UTC? is that OK?
Jose Luis
i want to store all the dates in UTC for compatibility :/
Jose Luis
is OK to use datetime.utcnow() ?
pino@mastrobirraio ~$
I guys i try to display some photos in a template. but the browser doesn't find the images.
https://pastebin.com/MYemcamn
Mirco
You can check if path is as u expect in a django shell , by making that queries
And check with console of your browser , in the network section if I don't go wrong, what path it calls
pino@mastrobirraio ~$
Mirco
Is that how you except or not ?
Mirco
pino@mastrobirraio ~$
the outcome is the same if i remove the MEDIA_URL from the src parameter of the img tag
Mirco
When you upload the image, do you find it inside media/home/photos ?
pino@mastrobirraio ~$
yes
pino@mastrobirraio ~$
i think the problem is in the image path generated by the template engine
Mirco
Have you already installed Django Debug Toolbar ?
Mirco
Try with
{{ photo.image_path.url }}}
This attribute gives you url of your images
Shibin
From where I can freelance work based on python django other than from freelance.com
Shibin
Pls suggest me if anyone knows
Wang
hello everyone
Wang
how to only display all email in Django user model
Wang
i can use sql statement
from email in user
Pradhvan
Wang
right, but i don't know how to use it
Pradhvan
Check out the django girls docs
Pradhvan
It's great for starting
Wang
i want get a email of list
Wang
or email of tuple
Pradhvan
What does your models look like ?
Wang
it's django come user model
Pradhvan
Oh ! I thought. My bad 😃
Ghorz
Please depaste it
Anonymous
How to click button on website with requests
Anonymous
Help me
Andrii
Did you hear smthing about screenshot?????
Wang
use a tag
Wang
pino@mastrobirraio ~$
Mirco
pino@mastrobirraio ~$
Mmm strange
yes, is like it doesn't indentify that the url to generate is a path to a photo and not a path to a media
inchidi
inchidi
try make it more normal with MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
pino@mastrobirraio ~$
https://pastebin.com/maUFcde4
The pastebin is exipiring
Mirco
pino@mastrobirraio ~$
is how it doesn't read these variables
inchidi
inchidi
pino@mastrobirraio ~$
let me try
pino@mastrobirraio ~$
i've tried
pino@mastrobirraio ~$
Doesn't work
inchidi
share your media url like this again
inchidi
oh and reupload your image
inchidi
and the url?
pino@mastrobirraio ~$
i'm trying to reupload the images
pino@mastrobirraio ~$
doesn't work
inchidi
nice now add this urlpatterns = [......] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
in your root urls.py
inchidi
you'll need these
from django.conf import settings
from django.conf.urls.static import static
pino@mastrobirraio ~$
django.core.exceptions.ImproperlyConfigured: Empty static prefix not permitted