Toto Syrax
import os from pathlib import Path . . DEBUG = True . . STATIC_URL = 'static/' MEDIA_URLS = '/images/' STATICFILES_DIR = [ os.path.join(BASE_DIR, 'static') ]
🏅♐Mark
it is already
Did you said path in settings.py in installed _apps section?
Toto Syrax
Did you said path in settings.py in installed _apps section?
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app', ]
🏅♐Mark
Use " "
Toto Syrax
Ok
Toto Syrax
🏅♐Mark
Doesn't work
Which browser using?
Toto Syrax
🏅♐Mark
🏅♐Mark
Chrome
Clear browser cache then try again
Toto Syrax
🏅♐Mark
Oo
Toto Syrax
Oo
Thanks by the way
Khaled
import os from pathlib import Path . . DEBUG = True . . STATIC_URL = 'static/' MEDIA_URLS = '/images/' STATICFILES_DIR = [ os.path.join(BASE_DIR, 'static') ]
did you install pillow for images and add the media urls to the urls.py? please share the network screen in your browser dev tools
Ильфат
Good day, friends! Need advice on a problem working with Django. I cant work statically with bootstrap. Bootstrap worked great, but the problem was to import it locally. Has anyone encountered this problem in Django? Thank you in advance! STATIC_URL = 'static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'templates/src'), ] {% load static %} <link href ="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet"> <script src="{% static 'bootstrap/js/bootstrap.min.js' %}"> The terminal returns 200 for bootstrap files. [10/Jun/2024 11:46:43] "GET /static/bootstrap/css/bootstrap.min.css HTTP/1.1" 200 232803 [10/Jun/2024 11:46:43] "GET /static/bootstrap/js/bootstrap.min.js HTTP/1.1" 200 60635
Ильфат
200 is the best http status that only happens https://www.google.com/search?q=http+200
The problem is that the console doesn't return any errors. But bootstrap doesnt work.
Ильфат
doesnt work is bad description
I'm developing a Django project where I want to use a local version of Bootstrap. However, when starting the server and trying to load pages, the Bootstrap files do not load properly. The static files (CSS and JS) are in the templates/src/bootstrap/ directory, but when I try to access them I do not get errors in the console and on the web page. dashboard_app/ manage.py dashboard_app/ settings.py ... templates/ src/ bootstrap/ css/ bootstrap.min.css js/ bootstrap.min.js ... My settings.py: import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'templates/src'), ] I can access the bootstrap.min.css file directly via the URL http://localhost/static/bootstrap/css/bootstrap.min.css What have I already checked I checked that the files are indeed located in the specified path. I made sure that the access rights to files and directories are correct. Restarted the server after making changes. Checked the server logs for additional errors. Cleared browser cache. The HTML page is returned without bootstrap styles. Can someone help me with this?
Abhi
Hey everyone just give me your thoughts about how I have a full frontend in react and I want to create backend in django so it's necessary i have to put all frontend in django folder Because in bootstrap I am using same method where I created a front end in django folders
Гафуров
Hello everyone, please help me to fix this error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
عبد القيوم
Keep learning 😂
@
Hi all I am beginner to Django. Is there damand in future for django? Replay all so this would be so helpful to all Beginners.
@
I found in web : Python with Django offers a more streamlined and accessible approach for integrating AI into web applications, thanks to Python's rich AI ecosystem and Django's ease of use and flexibility
Charly
Hi all I am beginner to Django. Is there damand in future for django? Replay all so this would be so helpful to all Beginners.
No one knows about the future. And django has the same capabilities to integrate AI as any other library because it has no specific functtionality for it
V0ltr0n
Hi all I am beginner to Django. Is there damand in future for django? Replay all so this would be so helpful to all Beginners.
There will rarely be demand for devs in future. Because of chatgpt anyone will claim to be a “senior dev”, “project manager “…
V0ltr0n
Bosses will be people who never wrote hello world. People with mba background telling you xyz is possible and should take 5 min tops. Programmers will be “a dime a dozen”
Gregory
HI help me i work with django gis. I saw this ``` qs = Zipcode.objects.filter(poly__contains=pnt) ``` It is simple because Zipcode(models.Model) from django.contrib.gis.db import models and he have PolygonField and PointField I have my prodaction model, where models from django.db and i have not PolygonField or PointField class Listing(models.Model): ListingKey = models.CharField(null=True, max_length=64, default=None) Longitude = models.CharField(null=True, max_length=64) Latitude = models.CharField(null=True, max_length=64) bat i have geo coords Longitude Latitude Hove can i filter my qweryset ? qweryset = Listing.objects.filter( .... ? help! P.S. Я write my polygons in frontend and send by API on beckend
Anurag K
Following clean architecture with django is good or not
Mirco
Following clean architecture with django is good or not
it's always good, not only applied to django
Sam
These are my models: class Course(models.Model): title = models.CharField(max_length=100, unique=True) class Lecture(models.Model): title = models.CharField(max_length=100) season = models.ForeignKey(Course, on_delete=models.CASCADE) file = models.FileField(upload_to="courses/files/") now i want to add a method that calculates the total hours of the all lectures for an specific course, for example i have uploaded 4 lectures and each of them are 1 hour long, so it has to return me 4. is this even possible ?
Gayatri
Please share me the notes for ajango full syllabus
Ajeet
Please share me the notes for ajango full syllabus
There is a tutorial on official website
Sam
let me have ur full code will see it
There is nothing special bro
Sam
class Lecture(models.Model): title = models.CharField(max_length=100) course = models.ForeignKey(Course, on_delete=models.CASCADE) file = models.FileField(upload_to="courses/files/") duration = models.FloatField(default=0) def save(self, *args, **kwargs): if self.file: clip = VideoFileClip(self.file.path) self.duration = int(clip.duration) clip.close() super(Lecture, self).save(*args, **kwargs) Also i wrote this code but when i want to add video trough the django`s admin panel i get the MoviePy error: the file C:\Users\ASUS\Desktop\Folders\Django projects\CourseShop_api\media\5377620-hd_1080_1920_30fps.mp4 could not be found! Please check that you entered the correct path. error
HAJI MASTAN
first check the file path
HAJI MASTAN
is the file available or correct
HAJI MASTAN
then check the upload directory
HAJI MASTAN
and also check dependency for movePy
HAJI MASTAN
check these points one by one
Sam
first check the file path
How ? it cant be wrong because im sending the file trough file input in panel
Sam
then check the upload directory
upload directory is in my Media directory
HAJI MASTAN
you can check the error it clearly says the mp4 file not found
_
any resource for an django interview. what concepts should a 1 year dev know. django + DRF + celery + postgress is my stack.
rtg
good morning! My django project runs ok with docker. Now how can i move the docker to Computer Engine of Google Cloud? I have created a VM in Computer Engine. But i don't know how to move the project.
rtg
thanks! 😉
O'ktamjon
Hi. Has anyone integrated Stripe with Django Rest Framework? If I'm not mistaken, I read that there are mainly two methods: 1. Creating a checkout session on the backend, then making the payment on the frontend, and Stripe sends a signal to the backend webhook. Based on this, you can check the payment status. 2. Charging the card directly on the backend with the provided card information, which does not require checkout or webhooks. Who has tried which method and which one would you recommend?
Mh
AttributeError at /user/auth/signin/ 'AnonymousUser' object has no attribute '_meta'
Mh
what this error
Venkatesh Akhouri
It seems clear from the error, your object AnonymousUser does not have any attribute called _meta Just check once what all attributes it has, it might be a typo
OmarHafiz87
Is it possible to add a hyperlink as a model field?
OmarHafiz87
Like URLField or something?
The Inspired
Is it possible to add a hyperlink as a model field?
Yes https://docs.djangoproject.com/en/5.0/ref/models/fields/#urlfield
Angle
May be this is not too related to django , again related to django hosting( Digitial ocean), i added block storage to main droplet , i want all new media uploaded to this folder block sotarge, 1-is this good idea? 2- should i specify location on models or settings.py also?
Admin
Hello everyone,i created admin user from django admin site.But i can't log in to admin site,how to fix it?
Angle
Yes just use the right location on settings
i uploaded many files and droplet used 100% and want all new media file uploaded to the new drive
Angle
Yes just use the right location on settings
if it is linux ubuntu should i type path directly?
Admin
Any error?
Error login or password
Prabhat
Error login or password
create another superuser and try again
Admin
create another superuser and try again
Why i need superuser,i can log in from my main account but i need log in from i created acc from admin site
Admin
because admin site is just for super users
I have standard settings nothing added,need some code for created users log in?