park seo joon
I have a model of team so I only want the team to be created once for each team name, while condition in views works for me in Django, it's quite different in drf
park seo joon
It's still creating a team with the same name
daft
It's still creating a team with the same name
Whatever table you used to create and save the team, set the team name to unique and always ensure that when saving to DB, there is a consistency in the way the name is saved.
Very
Hallo guys who has a break down of the adminLTE dashboard theme, as in sidebar,navbar,dashboard and footer in one file...kindly assist I need to use it in a project.
Chalaza
Hello guys how dangerous is it for a public Django web application to have it's settings.py file exposed with the secret key and all credentials seen.. Any body with a demonstration on how such an application can be hacked?
Doragonsureiyā
Hallo guys who has a break down of the adminLTE dashboard theme, as in sidebar,navbar,dashboard and footer in one file...kindly assist I need to use it in a project.
This is not a Django specific question, please delete your offtopic message. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
David
I have this error .AttributeError: '_Environ' object has no attribute 'Env'. but I install django-environ
David
I install django-environ and then I import it like import environ. The error will produce no module name environ
Doragonsureiyā
Alpha
Can anyone help me to create a django project in which I have to make employees tracker like mouse ,keyboard movement, screen shot capture and send to s3 bucket
Анвар
Hi! I would like to forbid requests for all routes BUT admin routes. Is it possible to override ALLOWED_HOSTS with custom middleware to implement this?
Анвар
Allowed hosts serve a different purpose.
I see. So, how possibly I can secure API endpoints from external requests (I have frontend web app that makes API calls, and both backend and frontend are on the same IP)? UPD: I already have Basic Auth for that
clouded
I see. So, how possibly I can secure API endpoints from external requests (I have frontend web app that makes API calls, and both backend and frontend are on the same IP)? UPD: I already have Basic Auth for that
Well, in that case allowed hosts in one step. CORS is another one, specifically to prevent other frontends from using your API. To prevent scripts from using your API you need authorization.
Roshan Rajak
where can i get source of this project by django ? djangosnippets.org
Charly
.
How to receive a values from HTML forma to a Variables in django
Charly
How to receive a values from HTML forma to a Variables in django
In a view, you can access to GET or POST data
Charly
Any Example
Have you checked the django documentation? at least the official tutorial?
Charly
Can anybody explain the flow so that i can understand better for making this
Only you know what would be the flow because thats the bussiness logic. What I can tell you is that you can't collect device data with django you need to build another program to collect that data and send it to django app
Yahya
rf templates?
Rest framework
Alex
Yes bro I want to post django template form data to api
You have to submit the data in form of json for it to be accepted
Silverhand
Hello people. Does anyone know how to solve this Live Reload not working error: LiveReload exception: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it> ?
Silverhand
we need more context
Installed LiveReload ( pip install django-livereload-server ) So that the page in browser will automatically update as I work on HTML and CSS. Fired up the server with no errors except the LiveReload one: python ./manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). August 22, 2024 - 09:21:09 Django version 5.1, using settings 'PT77.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. LiveReload exception: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it> I've opened its port in Windows Firewall, but the LiveReload still doesn't work. I work and run the server on a local machine. I did add 'livereload' into INSTALLED_APPS and 'livereload.middleware.LiveReloadScript' into MIDDLEWARE. That's basically all I did.
Papy
I prefer auto save
It's a pain when you have live reload n stuff
P33
hi Does anyone know when we use <int:pk> in our URLs?
cj
So when do we need to use it?
when you have the requirement to use them
Farzad
Can you give an example
need to pass some integar like id into your view func from url
P33
Do you know what that means?
No, honestly, I read some material about it, but I didn't understand
cj
Can you give an example
you'd better learn them first: https://docs.djangoproject.com/en/5.1/topics/http/urls/
Charly
Alex
No, honestly, I read some material about it, but I didn't understand
That pk stand for primary key, Take this as Universal id no. assigned to users, each user will have it's own unique PK, now if you need to call some user you can call them by their pk.
P33
Thank you all
Doragonsureiyā
Adding the word Django to your Off-Topic question doesn't magically turn it to a Django related question, so delete your question here and move to the @PythonOfftopic group and ask there.
Abhi
Means?
Nat
Hi Everyone, How can i remove django app after transferring the models to another app? Since I need the data I also made data migrations.
Babak
Hi,How can i add fonts to django-ckeditor-5?
Отабек
Hi guys. I need about some information how to deploy django project with tg bot in unbutu server
Отабек
If who knows please help me
The Inspired
usually people put the settings.py file in the gitignore
The Inspired
Hi Everyone, How can i remove django app after transferring the models to another app? Since I need the data I also made data migrations.
remove the app from INSTALLED_APPS in the settings.py file. Then delete the entire app folder. Make sure your models of that app are not dependent on any other models of other apps
The Inspired
Hi,How can i add fonts to django-ckeditor-5?
https://stackoverflow.com/questions/33495238/how-to-add-additional-fonts-like-google-fonts-in-django-ckeditor#33507080
Farzad
Hi Everyone, How can i remove django app after transferring the models to another app? Since I need the data I also made data migrations.
first delete it from installed apps, then check for errors, if you didnt get any then it is safe to delete it's folder
️امیر
usually people put the settings.py file in the gitignore
Actually, it's not best practice. The better practice is to separate the settings.py to multiple files like this: base.py local.py production.py Even in some cases, to more files Also, you must get sensitive data like secret_key and ... from environment variables, so you can keep the settings module in git and don't worry about sensitive data
Husan
Hi guys, could someone help me? I have an old database, which is more than 300 mln data. I changed my model structures after that I can't restore my old database as a backup file to my current project. So then I decided to write python shell code, which reads the old database and wrote to a new database but my code is very slow 🦥 because data is more and I am spending time more than I thought.
Aju
env and if sensitive files if any.
Nat
I'm working on the development branch, so deleting the app also deletes its migration history, including the data migrations I've made. Even if I apply the migration to my database, the server won't see the migrations, leading to an inconsistent migration history.
Nat
just never remove or modify migrations during development that have already made their way into the product environment
what about removing the app from installed_app, wouldn't this lead the new data migration i made unrecognizable?
Дмитрий
Hello! How to run Django backend On android ? I want kotlin app with Django backend. I know I can run Django in IDE on phone, but I need it as a background service
Charly
How you can run a server on android app?
No, I meant an external server
Charly
Whats the point of having a web app that cn only serve a local app?
Дмитрий
Point is to have our beautiful Django as a backend on android.
Charly
Point is to have our beautiful Django as a backend on android.
Makes no sense a web app to serve a single user
Дмитрий
Why?
Charly
Why?
Exactly because you need to run it as backgorund, it is just easier to implement that on oyu app
Дмитрий
Not seeing logic in this
Charly
Not seeing logic in this
Well, then good luck 👍
Дмитрий
I asked how to do it, not why I shouldn’t