Mamad
Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings
Upon make migration Django creates an environmental variable called DJANGO_SETTINGS_MODULE If any code tries to access Django modules before this init, you could face this error
Aruu
Ok
Maxim
Ok
just ask your real question
Mamad
So I should trace the latest codes
Did you write any custom scripts?
Mamad
Yap
Could be that Try using import django django.setup() Before your script Might not work but gives you a head space to work with and figure out the error
Mamad
Thanks, I will try it out and let you know.
Cool Hmu if you figured it out as well
️امیر
Upon make migration Django creates an environmental variable called DJANGO_SETTINGS_MODULE If any code tries to access Django modules before this init, you could face this error
When you're using python manage.py <command> It needs to find your settings module. In the default structure, it can find the module automatically, but when you change the structure (or maybe in some other cases), it can not do that. So you can set the module in the environment variables or set it while running the command like bellow python manage.py --settings=<settings_module> In your case, I guess you should use this command python manage.py --settings=<project_name>.settings makemigrations
ㅤ
How do we break our project to apps? Actually I’m working on a project which it contains product and service posts ,I don’t know what apps should I make!? can you please help me
️امیر
How do we break our project to apps? Actually I’m working on a project which it contains product and service posts ,I don’t know what apps should I make!? can you please help me
Based on 2 scoops of django: Explain the usage of your app, if you used more than one "and" your app is not good and you should break it to more apps
park seo joon
I'm done with the development of my Django project and I want to host. Can I ask how much will it cost and what are the best cloud services to use? I haven't hosted any project
park seo joon
I recommend render or railway
It's a huge project that consume a lot of data but not for user for now
park seo joon
I recommend render or railway
If those you listed above are best choice how do I go about both server, security and others
Charly
If those you listed above are best choice how do I go about both server, security and others
You don't, these are PaaS, they manage the server and most of the security
park seo joon
Nope_ff
i have done 2 projects on django i have basic knowledge but i want path to learn django framework any suggestion or free resources
Doragonsureiyā
i have done 2 projects on django i have basic knowledge but i want path to learn django framework any suggestion or free resources
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Elman
Does anyone know why I get a 500 server error when I turn off debug mode (set DEBUG to False) and specify valid hosts?
Elman
The thing is, this error occurs when I run the site on the server. However, I don't encounter this problem locally.
clouded
The thing is, this error occurs when I run the site on the server. However, I don't encounter this problem locally.
The status code is a first hint, but there isn't a single cause for it. Enable debugging and you'll see what the problem is.
Anurag K
Hi guys in production will daphane manage both https and ws connection or if i need to make gunicorn for http and daphane for ws
Elman
The status code is a first hint, but there isn't a single cause for it. Enable debugging and you'll see what the problem is.
I just change STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' to STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage'
Ναhom
Hi guys; I just want to know if I can make pdf reading website with Django where a pdf will not be downloaded but just readable.
Ναhom
If you can read it it means you download it
But there are such websites aren't there?
Farzad
But there are such websites aren't there?
If you want to display pdf in your template it is possible using iframe or embed html tags
Ναhom
Like which one?
https://openlibrary.org/
Charly
https://openlibrary.org/
These are not PDF, and what If i told you you can download them?
Ναhom
These are not PDF, and what If i told you you can download them?
Ok then what are them? Some of them are preview only; you see that too, right?
Charly
Ok 👌
So you want to display it regrardless if you can download it ?
Yahya
how to post a form data to rest api in drf
Charly
how to post a form data to rest api in drf
Form data? API is not supposed to handle forma data, just json
Alex
how to post a form data to rest api in drf
as suggested by @Carlangueitor that's not how you are supposed to use template form, unless you are sending from some javascript frontend then How is specific to that framework but if you want to go for template anyway use javascript to convert that form data to json and send, don't forget to properly handle csrf and all.
k9
I have implemented django-allauth for my ecommerce authentication. Everything working correctly, the user can create account no issue in development environment but after deploying it on vercel and connecting supabase pg. admin is misbehaving when i try to add any item it automatically redirects me to re-login and the process is the same can't add any item since am getting logged out. After checking the logs in vercel i get this ` Session data corrupted [WARNING] 2024-08-20T09:11:56.628Z f7629539-0c49-426f-9311-3b6b8d7d72c1 Session data corrupted ` What might be the issue.
Scarfish99
Hello. I have a question. I'm making a system to manage sales and purchases for a business. Naturally, a single sale or single purchase should take in multiple items. This is where I am stuck. I can't seem to make my project allow multiple inputs. Currently, I'm using forms and saleItem models and serializers to handle this logic The error I'm getting in Django is lists are currently not supported in HTML. I've tried fixing the error but nothing yet. I am on Google and stack overflow and quora (and AI tools). But I've been in circles. Kindly help. The stack is Django, DRF, Next Js and Tanstack for API calls
Purushottam
Is there any website or tool that can give list of all django modules and sbmodules, which can help understand the entire django suit which is structured. There is a website called ccbv.co.uk but is only for classbased views of django
Jahongir
What is the best thing to use in Django to search data from several models through 1 api?
Jahongir
Nothing, just do that in your view
I used Q. Is there an optimal solution?
Jahongir
I used Q. Is there an optimal solution?
resource_results = models.Resource.objects.filter( Q(name__icontains=query) | Q(description__icontains=query) | Q(type__name__icontains=query) | Q(classes__name__icontains=query) | Q(user__first_name__icontains=query) | Q(user__last_name__icontains=query) ).select_related("type", "user").prefetch_related("classes").only("name", "description", "type__name", "user__first_name", "user__last_name")
Parsa
Hello, good time, I had a question, if I write an app and define a post model inside that app, for example, and I want to do something to create a separate model from the media post, which has some features of the media posts of the same post, and now I have decided that instead of connecting from the post model to the media model, I want to connect from the media model to the post model with a foreign key. Class post(models.models): Name = models.charfield(max_length = 255) class MediaPost(models.Model): post = models.ForeignKey( post, on_delete=models.CASCADE, related_name='media_posts' ) title = models.CharField(max_length=50) slug = models.SlugField(max_length=255) file_path = models.FileField( verbose_name="File uploaded by users", upload_to="FILE/mediapost/", blank=True, null=True ) published = models.DateTimeField(auto_now_add=True) I mean, instead of connecting the post, I came to Media Post. I did the opposite. Do you think it will cause a problem?
Michael the wolf 🐺
In my django application, its getting crashed with sys.exit, when ever there is error in application itself? could gunicorn be interpreting application error as system level error and crashing? File "/root/.nix-profile/lib/python3.11/ssl.py", line 1166, in read 2024-08-20T16:43:44.665106139Z return self._sslobj.read(len, buffer) 2024-08-20T16:43:44.665108333Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-08-20T16:43:44.665110727Z File "/opt/venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 203, in handle_abort 2024-08-20T16:43:44.665113382Z sys.exit(1) 2024-08-20T16:43:44.665115657Z SystemExit: 1
Michael the wolf 🐺
does it get solved by handling exceptions at application level gracefully or any other good fix here?
Jahongir
This is my full code but need optimal solution
Jahongir
Doragonsureiyā
This is my full code but need optimal solution
Rule 5️⃣: Never post walls of text or screen photos. Use paste bins like https://dpaste.org, https://hastebin.com, https://bin.kv2.dev or your favorite one!
Douglas
I wanna be a professional in writing Django can someone refer me to a pdf I can down load and read
Douglas
Really
Charly
Really
Yes. what you where expecting?
Douglas
Don't know have been watching YouTube videos seems not to help get all I want
Charly
Douglas
Thanks for this I appreciate
•-elHam
Hi, How can I change the is_active default django to Flase? I use default django users
Alex
Bro I have created an api I want to post data to the api using django rf templates
by drf template do you mean this: https://www.django-rest-framework.org/img/quickstart.png ?
Alex
Hi, How can I change the is_active default django to Flase? I use default django users
Set is_active=False when users are being created or inherit the user class and change the is_active= False.
park seo joon
Please what is the best practice to implement condition between views or serializers. Let's for instance I have a signup form and I wants to check if the username the person is trying to create account with already exists?
Alex