Mendux
1.- In a proper deployment, Django does not serve any static thats done by the webserver 2.- Routing can clash if you are also using client side routing
#1 is not going to be an issue. In development, your Django will be able to fetch the static files in 'build' without any issue. On deployment, the frontend static files will also be collected to the server/bucket/container you are using for your backend static since on running ./manage.py collectstatic Django will look for static files in the dirs provided in STATIC_FILES_DIRS. #2 is the only issue I can think of in this implementation but it can be easily avoided by prefixing 'api/' to the backend routes.
Mendux
one final thing that I might have missed, on deployment, add PUBLIC_URL to your environment variable before building your frontend. This would resemble something like this: export PUBLIC_URL='url_to_your_static_container.com'
Mendux
this would tell the frontend on where to look for the static files
Mendux
using this approach would encapsulate your whole frontend into a single template "index.html"
Almaz
Hi everyone. Does anybody know if there is a library for django, which would provide logging for outgoing requests from the backend itself for any third party services. I looked for django silk and django debug toolbar, but seems they focus on incoming req/res.
Nitesh
How to implement dot env in Django like in node js
Mendux
How to implement dot env in Django like in node js
pip install django-dotenv manage.py ..., import dotenv def main(): dotenv.read_dotenv() ...
ERMIA
pip install django-dotenv manage.py ..., import dotenv def main(): dotenv.read_dotenv() ...
For production it not gonna work cause host whould use wsgi so better to put .env into bulk edit of env variables
k
Python django "without"packaging it deploy Lambda integrate with api anyone knows
Doragonsureiyā
Python django "without"packaging it deploy Lambda integrate with api anyone knows
Don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello, I need help on $z!" Just ask directly! The better you are at explaining the problem, the more likely you are to get help. Asking smart questions
k
Y don't you dockerize?
Team lead said flow this method
Binoy
Django session missing sometimes, and automatically logging out for some users in production. Its only happens occasionally Im using DB sessions. How can I debug this? Thanks in advance.
Mendux
For production it not gonna work cause host whould use wsgi so better to put .env into bulk edit of env variables
yeah.... switch to environment variables on production which I guess is something one would want to do.
Данил
Hello Everyone! How do I migrate data and models in Django from sqlite3 to PostgreSQL?
ㅤㅤㅤㅤ𝗹𝗼𝗿𝗱ㅤㅤㅤㅤㅤ
Hello Everyone! How do I migrate data and models in Django from sqlite3 to PostgreSQL?
Both databases structure are relational so I don't think there's something more configuration to do
Mirco
Hello Everyone! How do I migrate data and models in Django from sqlite3 to PostgreSQL?
That's why you must not use different DBs Start with one and use that one everywhere
ERMIA
Federico
Hello. When I try to save this object: {'_state': <django.db.models.base.ModelState object at 0x7f0849331310>, 'dayOfWeek': 0, 'hours': [8, 9]} It gives me this error: sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type. This is the model: https://pastebin.com/ZTpbCBdM Thank you in advance ( I'm using sqlite3 )
Afshin👀
hello there how can I create tether wallet for my users in my site?
Afshin👀
does this have anything to do with Django?
and what about pywallet in python?
Afshin👀
sorry I do not understanded. what do you mean
Afshin👀
i asked the question
I want to create wallet tether with python in django for my site
Afshin👀
I want do this in django with python so
Leonardo D'Amato
I have an Orders model, also in it there is one field that stores an id to a second Photo model that stores photos by a certain field. There is also an OrdersSerializer that serializes data using the Orders.objects.all() queryset. So the next question. How can I add an additional field in the serializer, query the Photo.objects.filter(number_photo=number_photo) model, and add an additional field with specific data to each object?
Leonardo D'Amato
Thanks🙏🏻
Afshin👀
does this have anything to do with Django?
so I have to created in django
Maxim
so I have to created in django
study the documentation and do your work no questions will help you unless you understand what you're about to do
Leonardo D'Amato
I have an Orders model, also in it there is one field that stores an id to a second Photo model that stores photos by a certain field. There is also an OrdersSerializer that serializes data using the Orders.objects.all() queryset. So the next question. How can I add an additional field in the serializer, query the Photo.objects.filter(number_photo=number_photo) model, and add an additional field with specific data to each object?
For example, the OrdersSerializer returns the following objects { 'pk': 1, 'title': 'green', 'user': 'User' } And me need to add an additional photo field: { 'pk': 1, 'title': 'green', 'user': 'User' photo: [ '/media/<path>/', '/media/<path>/', '/media/<path>/' ] }
Jairaj
I'm facing some problems with gunicorn with its configuration file in python I'm not able to find a solution to restart it in case gunicorn stops
Supra
Any one have django course?
You could check out Django tutorials from Corey Schafer on YouTube. Although its a few years old, the concepts he explains is very clear and well explained.
Duong Chan Troi
How to fix this error? FileNotFoundError at /register/ [Errno 2] No such file or directory: '/home/runner/.cache/pip/pool/94/b4/cf/common-passwords.txt.gz' Request Method: GET Request URL: http://django-test--vnu.repl.co/register/ Django Version: 4.2.1 Exception Type: FileNotFoundError Exception Value: [Errno 2] No such file or directory: '/home/runner/.cache/pip/pool/94/b4/cf/common-passwords.txt.gz' Exception Location: /home/runner/django-test/venv/lib/python3.10/site-packages/django/contrib/auth/password_validation.py, line 239, in init Raised during: users.views.sign_up Python Executable: /home/runner/django-test/venv/bin/python3 Python Version: 3.10.8 Python Path: ['.', '/home/runner/django-test/venv/bin', '/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10', '/home/runner/django-test/venv/lib/python3.10/site-packages', '/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python310.zip', '/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/lib-dynload'] Server time: Wed, 24 May 2023 04:31:20 +0000
Duong Chan Troi
http://django-test--vnu.repl.co/register/
Mendux
have you by any chance modified the AUTH_PASSWORD_VALIDATORS section in settings.py? you should also confirm whether you have common-passwords.txt.gz in you env/django/contrib/auth/
Duong Chan Troi
Let me try
Duong Chan Troi
Here is default: AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ]
Mendux
if not, you'll need to get one from https://www.djangoproject.com/download/4.2.1/tarball/ and place it in a dir accessible by Django then modify: AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validators.CommonPasswordValidator', 'OPTIONS': { 'common_password_file': '/path/to/common-passwords.txt.gz', } } ]
ask
Hello everyone, I've a django project code, on that single codebase two instance are running like projectA and projectB, code has conditions like which functionality to run if instance is projectA or B, Now I want to set up separate .po files for both instances how can I do that???? Anyidea???
Federico
I cannot get how is the code related to the model. Your model wants an integer and some integers in an array You have entirely different things there
Actually I found out that the problem was that sqlite doesn't support ArrayField, so I had to change it
Андрій "𝐇𝐲𝐓𝐚𝐜𝐤𝐞𝐫"
https://nekobin.com/yiwifewuno i have problems with django + celery. help pls
Nobita
Can anyone suggest best django tutorials
Doragonsureiyā
Can anyone suggest best django tutorials
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Nobita
Ok thanks
Doragonsureiyā
Rule 5️⃣: To share code or error tracebacks, use an online pasting service like: - https://dpaste.org - https://linkode.org - https://hastebin.com - https://bin.kv2.dev If you posted a wall of text, go back and delete it.
Дониёр Муминов
sorry
Shivam
Shivam Sharma: Any body  know how to install swagger in django I'm getting errors Autoschema object has no attribute get_link
anrays
hello guys how i can deploy django asgi application in cloud servers,?
Mohit
Shivam you can use dj_swagger
Mirco
Shivam you can use dj_swagger
drf_spectacular much better
MATHI
Anyone help me to Jwt token based authentication
MATHI
i used the older package simple_jwt in my laptop. The same code i run my pc it show many errors. I search about the error it says using older version of jwt. What can I do
MATHI
What are the changes i make in the settings.py file
Mukitar
hey guys help me the code how to send data from html using ajax to django rest framework
Anonymous
how to access specific seralizer attribute ???
jūdê
how to access specific seralizer attribute ???
In what context? What part of your code?
Yoi
Hi Fellas, I hope you are doing well. I want help from anyone who has worked with django-helpdesk and created a custom fields and a parser for email to ticket. Thanks in advance for your replies
Yoi
No one can help you until you explain your difficulties.
Yeah sorry you are correct, so I am trying to create an ITSM tool for learning purpose and can help me build a custom fields which can populate by itself ( for example date and time assigned to analyst, calculation of SLA based on resolution time, etc) Another issue is how can I create a custom parser which can take input from email and create ticket. I know these are very generic queries but everything I cannot explain as I am a newbie so please guide me further
Kareem
Is django channels good for production? I am making a chat app for users to talk to like a support panel. The idea is a user can go into support and open a ticket and talk via chat with the support or like a support tech person
Рy
Hello, Please I am trying to upload files using axios to my django backend. But anytime I pass the content-type as multipart/form-data, I get an error saying "Multipart form parse error - invalid boundary in multipart:none" Please how can I solve this issue
Aniket Kumar
Can anyone help me in django from basics to advance
Doragonsureiyā
Can anyone help me in django from basics to advance
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Leonardo D'Amato
How to make it so that the user who makes a data update ( PUT-request ) has his streaming ForeignKey records displayed?
DoT
i connected my django project to mysql database and did changes in setings.py file when i enter details in my project it stores in django admin panel instead of my local databse can anyone tell me why