Charly
see: https://dev.to/guin/writing-a-django-data-migration-with-real-world-example-40m
Bola
Anyone with course on Django REST API should help me with it
The Inspired
Bola
what is your issue?
I only need it to learn some basics just like CRUD, signin, signup, forget password etc
The Inspired
not sure I understand
Bola
I said I need to learn Django REST framework
Bola
Just for learning purposes
Cc
Hi, if you want to learn you can search video tutorials in youtube, there are some that show the basic concepts, CRUD etc. I recommend you the DRF documentation is intuitive
Bola
The Inspired
...
Maryam
Hello، i have a problem with pgadmin and postgresql, I almost tried all the solutions but non of them worked for this problem, It’s not connecting to the server when i enter the password it says connection timeout expired
Doragonsureiyā
aditya
Vishal
1. Consider a situation where you need to migrate your database from MySQL to Postgresql , but at the same time live data for your site from users keep on coming, without downtime how would you migrate?
2. In production, migrations folder is deleted (database is still alive) so, if you want to change the table schema then how did you do that ? (Because current changes depends on previous migration)
Answer
1. Just dump a copy of your database and then restore that dumped file into the postgres database. And then write the configuration of your postgres database, in settings file, with your default database. Generally, at night most of the sites have low traffic, at that time you can switch your database.
2. If your migration file is deleted, just run make migrations command, and then run
python manage.py migrate --fake,
this command will run a fake command for your newly created migrations.
Alex
Lucky
Heya, I'm trying to set the default of a model column to currval(pg_get_serial_sequence('public.user','id')), as in https://stackoverflow.com/a/78741427/3423324#postgres-default-column-to-own-id
I tried
from django.contrib.auth.models import AbstractUser
from django.db.models.expressions import Func
from django.forms import IntegerField
class CurrVal(Func):
# noinspection SpellCheckingInspection
function = "CURRVAL"
output_field = IntegerField()
class PgGetSerialSequence(Func):
function = "pg_get_serial_sequence"
class User(AbstractUser):
substitute_user = models.ForeignKey('user.User', null=True, on_delete=models.SET_NULL, db_default=CurrVal(PgGetSerialSequence('public.user', 'id')))
However, it fails with
user.User.substitute_user: (fields.E012) CurrVal(PgGetSerialSequence(F(public.user), F(id))) cannot be used in db_default.
Any clue how I can get raw sql into the database default?
Kapil
I want to deploy my django project on hostinger any buddy can help me to do
bobus
Why don't you use youtube guide?
Taha
Taha
clouded
Ohotnik
I got this error:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 5.0.6
Exception Type: TemplateDoesNotExist
Exception Value:
products/index/
Exception Location: /home/salyh/first_project/venv/lib/python3.10/site-packages/django/template/loader.py, line 19, in get_template
Raised during: products.views.index
Python Executable: /home/salyh/first_project/venv/bin/python
Python Version: 3.10.12
Python Path:
['/home/salyh/first_project/store',
'/usr/lib/python310.zip',
'/usr/lib/python3.10',
'/usr/lib/python3.10/lib-dynload',
'/home/salyh/first_project/venv/lib/python3.10/site-packages']
Please help 🥺
Charly
Ohotnik
Can i send a photo?
Ohotnik
I created the app products in products directory and in directory is located my templates
Ohotnik
My English isn't good, i hope that you understand me
bobus
We understand da da
Anees
Anees
so your index path should be something like this.
project-root/products/template/products/views/index.html
Anees
if your app name is store the it will be like
/home/salyh/first_project/store/template/store/products/views/index.html
Ohotnik
Alex
Alex
But it should redirect me to admin interface not main url
server {
listen 80;
server_name admin.myproject.com;
location / {
proxy_pass http://127.0.0.1:8000/admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
}
Alex
also make sure your allowed host are configured properly.
Priyanshu Pratap
Hey everyone i just have a doubt like when we make our rest api and uses jwt for authentication how django authenticate user like when we register the user and we get the access token as well as refresh token and store them in local storage of client and when the user sends the request to login then we send the generated tokens in headers to the login authentication endpoint of our backend. My question is how it authenticates the user on the basis of previously generated token during registration... is tokens gets stored in backend ? Like how it verify?
Pandu
i want to make a song plaform using react+django
i'll add features like
lyrics, song, blog, live chat.
should i learn DRF or Django Ninja?
Pandu
i saw drf has builtin features like authentication , route permissions,
but i hear ninja is faster. lightweight
should i implement it mannually in ninja?
or just learn drf?
The Inspired
The Inspired
its not stored in the DB, though you can store it if you want to
The Inspired
oh someone already answered it, my bad.
Anees
Anees
If anyone has experince with browser fingerprints do contact me
The Inspired
Alex
Simran
Can someone please help me connect django and react
Priyanshu Pratap
Simran
It's very confusing
Simran
I need to complete it in 2 days I've all set up ready
Priyanshu Pratap
What problem you are facing have you configured CORS in settings.py
Simran
Simran
I've used cors in settings
Alex
Yes I don't know how to run
it's hard to resolve issue without you sharing codebase or steps you took to connect the frontend and where you are facing the issue.
aditya
Tirth
Hello..I am new to django..can someone guide me where I can learn properly ?
Bekzod Juraev
Guys front or backend should handled Google authocation i did in drf entirely backend it is good?
Bekzod Juraev
Anees
Mirco
Arsham
Anees
i think it have 8 parts ,dont skips just finish one by one.
Arsham
what about "Code With Mosh" course?
Anees
I am not fan of courses. In last 14 years what i learn is to read the official documentation. Its verborse, does not contain unnecessary dicussion and you can always rely on it.
Anees
its upto you how you learn.
Jyothi
Hii I am connecting django with react
Jyothi
Can I do it without rest frame work
Jyothi
Anyone can explain the flow
Alex