Shreyashee
I needed some help with django
Shreyashee
Please text whoever is free and can help now 🙏
Vaibhav
_Giulio_
Hello everyone. I tried running migrations on Django to my Postresql and got this message
(myenv) (base) C:\Users\LAZ\my_portfolio\myenv>py manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
No migrations to apply.
(myenv) (base) C:\Users\LAZ\my_portfolio\myenv>
I have registered my app in the settings.py as well. What could I be missing please?
#
Ur Friend
How to change the api domain in Django rest framework
_Giulio_
Is migrations happend?
I am not sure because when i try checking, I get no relations as you can see below
postgres-# \c portfoliodb
You are now connected to database "portfoliodb" as user "postgres".
portfoliodb-# \dt
Did not find any relations.
portfoliodb-#
#
Check first migrations in db or not
#
Select * from django_migrations
Swati
serializer_class = None in action decorator is good practice?
whoami
Hi all.
I have a url
localhost:8090/api/v1/page/dynamic/<str:slug>/
and when i try to get
localhost:8090/api/v1/page/dynamic/category/product/iphone-14/ (my slug is 'category/product/iphone-14') its raising a 404, does anyone know why and how i can fix it?
Gautam Yadav
Hello, can anyone help how to implement fcm push notification in django
Cheshtaaaaaaa
Can we access django variables in javascript?
Cheshtaaaaaaa
Ali
I am not sure, but there is a work around to be able to do so
Ali
In your html, assign data-attribute to the variables you want
Ali
And then you can access these values in javasacript
Ali
I've done it before
Ali
Do you know how to use data-attributes in javascript?
Nikita
hello
everyone, I have a problem with adding dimensions to select
there is a table on the site that is updated with new rows. And when adding new rows, I have all the dimensions added to the first row.
How to make option be added only to its own line (tr)?
Nikita
$.each(sizes, function (k) {
$('.options-list-sizes').append(<option value=${sizes[k]['optionId']}>${sizes[k]['name']}</option>);
})
Nikita
Hamza
How can show the (is_active ) field from Django admin model ??
Ali
Hamza
yes
Ali
You need to override the user admin
Ali
https://stackoverflow.com/questions/2552516/changing-user-modeladmin-for-django-admin
Ali
Check this
javad
maybe this help :
split the title to two part
part 1 is your category
part 2 is your title
so you'll have :
localhost:1234/product/<str:category>/<str:title>/
localhost:1234/product/catalogue/iphone-14
Lucas M.
good morning people, from my development team we are transferring our application to the production environment in a windows server, the application is already working, but when saving images, we are experiencing problems when trying to see them, since the DEBUG = False and django can't serve media files, how should I configure access to media files already in production? Thank you.
in the settings.py I have this:
STATIC_ROOT = os.path.join(CORE_DIR, 'staticfiles/') # utilizado con el comando py manage.py collectstatic
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(CORE_DIR, 'apps/static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
Hamza
Check this
django.contrib.admin.sites.NotRegistered: The model User is not registered _________ i got this error when i unregister(User)
Ali
good morning people, from my development team we are transferring our application to the production environment in a windows server, the application is already working, but when saving images, we are experiencing problems when trying to see them, since the DEBUG = False and django can't serve media files, how should I configure access to media files already in production? Thank you.
in the settings.py I have this:
STATIC_ROOT = os.path.join(CORE_DIR, 'staticfiles/') # utilizado con el comando py manage.py collectstatic
STATIC_URL = '/static/'
# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
os.path.join(CORE_DIR, 'apps/static'),
)
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
As far as I know, this is done on purpose in Django's architecture. The purpose behind it is that they don't want django to serve files so they leave it to other services (like AWS S3 buckets).
As for me, I use AWS S3 to serve both static and media files in production.
If you only want to serve static files tho, you can use a library called Whitenoise. Two lines of code and you're ready to go. But it doesn't serve media files.
Ali
Hamza
Ali
Make sure your import is the following:
from django.contrib.auth.models import User
Ali
It works fine for me
Hamza
What is Django version?
Ali
4.1
Lucas M.
Hamza
4.1
Me too
But not working this unregister
Ali
Ali
I have an article bookmarked, but I don't have my laptop right now.
This video was helpful too:
https://youtu.be/inQyZ7zFMHM
Ali
Lucas M. Check it if you want
Lucas M.
Ali
You're welcome!
Ali
Thanks!!
Here is the article:
https://simpleisbetterthancomplex.com/tutorial/2017/08/01/how-to-setup-amazon-s3-in-a-django-project.html
javad
Hi
Does anyone have tutorial about reset password in Django Rest ? a complete tutorial
Shaedul_Off
Hi there
https://pastebin.com/pBqbzwMg
Shaedul_Off
help me
type object 'Article' has no attribute '_default_manager'
whoami
i have a products, and export these products in a excel or csv type, this export making at user interface level, i wanna do this process in background. anyone who knows how i can do this?
▄︻デռǟɦօʍ══━一
how i can show cv2 live footage on django?
Somvit
I got a static file related problem. when I use collectstatic command it only copies half of the static files and rest of them are shown to be post processed. thats why the images i used in my website not seen.
.
.
Somvit
I have checked twice but none of this helped
Somvit
1491 static files copied to 'I:\carzone-DEPLOYED\CARZONE\static', 1138 post-processed.
Somvit
Somvit
my main motive is to copy the rest 1138 files which are shown to be post processed
Somvit
any suggestions??
.
Share media url and url. Py file
.
Somvit
I have also checked that when i turned debug = True then all the static files are loading correctly but when i turned it false then it shows this error
.
Okay
Somvit
sent
Somvit
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'carzone/static'),
]
# Media settings
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
Somvit
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('pages.urls')),
path('cars/', include('cars.urls')),
path('accounts/', include('accounts.urls')),
path('socialaccounts/', include('allauth.urls')),
path('contacts/', include('contacts.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Jhoan
How switch from modelserializer to dict and keep functions
ROBO HEAD
Is there any way to join two tables without foreign key?
Doragonsureiyā
ROBO HEAD
Is it possible through ORM ? Or I need to execute raw join query ?
Maxim
Sorry screenshot
don't give bad advice
media is not allowed here for the reason
Tanner
Or something similar
Christian
Hello!
I have a doubt about HttpRequest and QueryDict, QueryDict.copy() will make a copy of whole request?
I need to add a new header to the request to call to another class-based view like AnotherView.as_view()(request=new_request)
I'm ASUR
Anyone can solve these Q
How to edit the mapping data using select2
Mohammed
Hey anyone here can help me with how to make track active users in chat group in django channels
Sloth
Hi
I have been maxims like "fat models and thin views" for code quality in Django.
How is it done? for example i have a complex buisness logic of 500 lines that makes a JSON that is efficient for the UI to read
can someone give an example? or a resource?