أحمد
I use django framework to build e-commerce website , when i use database like mySQL and potgresql ??
Asterix
Can i make something when my project copied to other place, may not work
Doragonsureiyā
Can i make something when my project copied to other place, may not work
Read this please: http://www.catb.org/~esr/faqs/smart-questions.html
Asterix
not enough details to answer
If i had project the other programmer may copy my project and start in own one
Maxim
Yes
don't give access to other programmers
Asterix
Ok thanks for helping
Eric
Can i make something when my project copied to other place, may not work
what you need to do is keep all your business logic or the core logic of your program in the backend as an API. host your backend and don't share it with anyone. then you can hire or partner with frontend devs to build web or mobile frontends.
Asr
Hey I want to ask one thing in api response when we send data. We have to send only primary key of other tables or name of them.
Maxim
Hey I want to ask one thing in api response when we send data. We have to send only primary key of other tables or name of them.
wrong part of the question we can send anything we want or the question is missing some details
ラーフル
django new version?
ラーフル
what?
i just saw a post about django 5.2
Maxim
i just saw a post about django 5.2
check Django's official site
Mirco
django new version?
5.2 LTS released
Eddy
"Guys, I need to set up a payment gateway (Pix, credit card, and boleto). Any suggestions?"
Doragonsureiyā
"Guys, I need to set up a payment gateway (Pix, credit card, and boleto). Any suggestions?"
This is not a Python specific question, please delete your offtopic message, move to @PythonOfftopic and ask there.
Denis
<span style="color: gray;">{{ post.pub_date|timesince }}</span> why doesn't it work?
Denis
Everything works , my inattention
mbk
Hi We are using django 3 And we need a LTS version which would be helpful for our project Any suggestions to which version shall we upgrade it to ?
Sweet
Hello everyone After the last docker update, I ran into a problem that I can't fix in any way. I used to use the following command to start an application during development: uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload And everything worked fine, when making changes to the code, the server rebooted and the changes were applied, but after the last docker update, the command stopped working and django stopped seeing changes in the code. I changed the command to a more precise one, and django seemed to see the changes and restart the server, but the changes were not applied. uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir /app I checked the code in the container and the changes were visible there, but they still didn't work. I tried to write a separate config for starting the application : if __name__ == "__main__": uvicorn.run( "app.asgi:application", host="0.0.0.0", port=8000, reload=True, reload_dirs=["/app"], ) But that didn't give any results either. It doesn't help even if I restart django in docker containers, only restarting the entire container helps. I tried specifying volumes in more detail, but that didn't have any effect either. volumes: - type: bind source: . target: /app consistency: cached I check file permissions in container and everything looks fine. I tried running python inside a container with the -B flag to avoid creating caches, but that didn't work either. I have updated the wsl. I tried using runserver and it didn't help either. All the code that I use to start the container: django: build: context: . dockerfile: Dockerfile.dev container_name: django ports: - "8000:8000" command: > bash -c " python manage.py makemigrations --noinput && python manage.py migrate && python manage.py boot_cache && uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir /app " volumes: - .:/app environment: - DJANGO_SETTINGS_MODULE=app.settings_dev - DEBUG=1 - CELERY_BROKER=redis://redis:6379/0 depends_on: redis: condition: service_healthy Maybe someone has encountered something like this and found a solution? Using: Django: 5.1.8 Docker: 4.40
HAJI MASTAN
Hello everyone After the last docker update, I ran into a problem that I can't fix in any way. I used to use the following command to start an application during development: uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload And everything worked fine, when making changes to the code, the server rebooted and the changes were applied, but after the last docker update, the command stopped working and django stopped seeing changes in the code. I changed the command to a more precise one, and django seemed to see the changes and restart the server, but the changes were not applied. uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir /app I checked the code in the container and the changes were visible there, but they still didn't work. I tried to write a separate config for starting the application : if __name__ == "__main__": uvicorn.run( "app.asgi:application", host="0.0.0.0", port=8000, reload=True, reload_dirs=["/app"], ) But that didn't give any results either. It doesn't help even if I restart django in docker containers, only restarting the entire container helps. I tried specifying volumes in more detail, but that didn't have any effect either. volumes: - type: bind source: . target: /app consistency: cached I check file permissions in container and everything looks fine. I tried running python inside a container with the -B flag to avoid creating caches, but that didn't work either. I have updated the wsl. I tried using runserver and it didn't help either. All the code that I use to start the container: django: build: context: . dockerfile: Dockerfile.dev container_name: django ports: - "8000:8000" command: > bash -c " python manage.py makemigrations --noinput && python manage.py migrate && python manage.py boot_cache && uvicorn app.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir /app " volumes: - .:/app environment: - DJANGO_SETTINGS_MODULE=app.settings_dev - DEBUG=1 - CELERY_BROKER=redis://redis:6379/0 depends_on: redis: condition: service_healthy Maybe someone has encountered something like this and found a solution? Using: Django: 5.1.8 Docker: 4.40
This issue is reminiscent of problems reported with Docker on WSL2, especially after updates. Common fixes include forcing polling, adjusting volume consistency, or moving to the WSL filesystem. If you’re still stuck, sharing your Dockerfile.dev or checking Docker’s GitHub issues for 4.40 might reveal specific bugs.
Sweet
This issue is reminiscent of problems reported with Docker on WSL2, especially after updates. Common fixes include forcing polling, adjusting volume consistency, or moving to the WSL filesystem. If you’re still stuck, sharing your Dockerfile.dev or checking Docker’s GitHub issues for 4.40 might reveal specific bugs.
I kind of solved this problem by just running django locally, and rest of the services via docker. I tried rolling back docker to version 20 and it didn't help, I tried updating wsl and it didn't help either. I tried the pooling approach and it didn't give any results either. Moving to the WALL filesystem sounds too complicated for me. Here is my docker-compose: https://pastebin.com/6a0bKQJC I found several similar problems on github, but they remained unresolved.
HAJI MASTAN
Or use delegated consistency to reduce overhead as you are running multiple services (django, celery, celery-beat, flower) mount .:/app, which could strain WSL2’s filesystem sync, so for this i think delegated is good as delegated prioritizes container performance, reducing sync latency that might confuse Uvicorn’s watcher
K A R T I K
Django book
Doragonsureiyā
Django book
This is not a search engine. If you use this group like a search engine, unlike a search engine, you will not get any answers. Please take the the time to formulate your request clearly and remember that you're talking to humans.
zmod
hello django people i have a project which calculate a employee attendance record, the raw data from.biometric contains empid, deviceid, date, time. thats it. Then raw data is in csv form when i upload to a django immediately process the data for bulk insertion in my database table using posgresql. my question is what is the best approach in calculating pay rules like number of working hours, under time, over time, double pay on holiday. other question is better to implement it in database level for calculation or in the django application level. may i know your best approach to this. or if you a sample for this. im thinking for storing the pay rules for example the rate percentage calculation base on employees rate per hour and so on. these configuration of pay rules is stored in jsonb field, so every roster schedule a pay rules attached to it. for now thats my plan.
zmod
i already setup a container for redis, celery and celery beat. but not yet implemented since its new to can you add me to a private convo, if u dont mind.
zmod
im purely using the django admin panel this time to complete this task, no views, and urls
zmod
just models, forms and admin
Bekzhan
Hello to everyone who connected mssql on the odbc 17 driver, via wsl , I get an error, how to fix it File "/mnt/c/Users/ /Desktop/nistrz/venv/lib/python3.12/site-packages/django/utils/connection.py", line 62, in getitem conn = self.create_connection(alias) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users//Desktop/nistrz/venv/lib/python3.12/site-packages/django/db/utils.py", line 193, in create_connection backend = load_backend(db["ENGINE"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/c/Users//Desktop/nistrz/venv/lib/python3.12/site-packages/django/db/utils.py", line 126, in load_backend raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'mssql' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3'
E
Hi guys! In DRF browsable api for HTML form Group ids i need to list all user groups for selecting by user. But got "No items to select" https://dpaste.org/dGB7e Output: https://dpaste.org/Fxvvt
Bekzhan
Have you googled django mssql?
yes, of course, but I couldn't solve the problem. When connecting, he writes : (venv) mukhtarbekov@trz-fm-ws-07595:/mnt/c/Users/mukhtarbekov_b/Desktop/nistrz/nisservice$ python test_db.py Ошибка подключения: ('08001', '[08001] [Microsoft][ODBC Driver 18 for SQL Server]SSL Provider: [error:0A000102:SSL routines::unsupported protocol] (-1) (SQLDriverConnect)')
E
queryset for group_ids in line 8 of the pastebin code has None :)
But in init i add data I need to filter data, not just all groups
E
why are you doing that on __init__ ?
Better say me where i need to do it) Found on stackoverflow
cj
Better say me where i need to do it) Found on stackoverflow
I first want to understand why are you doing that
cj
all logic should be done in views
HAJI MASTAN
Hi guys! In DRF browsable api for HTML form Group ids i need to list all user groups for selecting by user. But got "No items to select" https://dpaste.org/dGB7e Output: https://dpaste.org/Fxvvt
The "No items to select" issue is likely due to the PrimaryKeyRelatedField not picking up the dynamically set queryset during browsable API rendering. Use a custom PrimaryKeyRelatedField with a get_queryset method to dynamically evaluate the queryset
E
I first want to understand why are you doing that
So, by http://localhost:8000/api/v1/organization/users/100/ i got this response (1). It's right but also i should have possibility to select several groups in DRF browsable api and update it. Answer your question: Because the user is not present on the serializer but in init it is and i need to filter it by user.organization. 1. https://dpaste.org/1GBq0
E
again, all the logic should be done in views (and there you'll have direct access to the request object)
no problem but how can I assign data (that i proceed in viewset) for group_ids field?
The Inspired
But in init i add data I need to filter data, not just all groups
try doing a print statement inside init to see if any data even exists
E
this one?
code with output https://dpaste.org/wjQnN
The Inspired
hmm...
The Inspired
definitely something is wrong... just can't put my finger around it... if you say data is coming, then something else might be wrong.
The Inspired
this could be the solution
E
definitely something is wrong... just can't put my finger around it... if you say data is coming, then something else might be wrong.
it seems that group_ids field takes OrganizationGroup.objects.none() and doesn't overrided by init
The Inspired
that's because you have given OrganizationGroup.objects none in your viewset, which is what I told you initially
E
that's because you have given OrganizationGroup.objects none in your viewset, which is what I told you initially
Above attached output, where available_groups have data Viewset: https://dpaste.org/DjeX9
hamid
Hi everyone I'm locking for a good way to store site statics by statics i mean for example there is about us page and in about us there are title picture and a text. the question of mine is how to store these statics it's not that good to create a table and it's not store able by a key value settings table i also want it to be editable in admin panel any solution or suggestion.\
hamid
I don’t believe your question is clear enough Do you want to store static files or have a way of uploading and updating these files eg images?
no no Have you ever seen those pages like about us wtih a pictures and description and title ? there just one record so it's not that good to create a database table for just one record
Charly
You want to be editable in the admin, if not just make them static tempaltes
hamid
And?
It's not that good to create an database table , It is?
hamid
Why you say is not?
because that table is going to have just one record