ㅤSina
Help me with how I can pass a request token to the server if HttpOnly is enabled. I implemented the transfer with HttpOnly disabled, here it is:
const UserProjects = () => {
const [projects, setProjects] = useState([]);
useEffect(() => {
const fetchProjects = async () => {
try {
const accessToken = Cookies.get('jwt_token');
const refreshToken = Cookies.get('refresh_token');
console.log('Access Token:', accessToken);
console.log('Refresh Token:', refreshToken);
const response = await fetch('http://127.0.0.1:8000/api/projects', {
headers: {
Authorization: `Bearer ${accessToken}`,
'X-Refresh-Token': refreshToken,
},
});
if (response.ok) {
const data = await response.json();
console.log(data);
setProjects(data);
} else {
console.error('error get project:', response.status);
}
} catch (error) {
console.error('error get project:', error);
}
};
But I don't understand how to get a token when HttpOnly is enabled
you can't access http only cookie with client side javascript. but you can set " credentials: 'include' " inside your fetch, to automatically send cookies on api calls
Otabek
ㅤSina
cj
same with you, you can dockerize a PHP, Java, .Net project... it doesn't mean you have an issue with PHP, Java or .Net project... does it?
cj
this group is to talk about Django issues, not 3rd part tech
Kiki
Django4 vs Django5; and why?
Doragonsureiyā
Django4 vs Django5; and why?
Step 1: Open a browser
Step 2: Write down https://google.com or https://duck.com and press Enter
Step 3: In the search box write down the same words you asked here
Step 4: Read the firsts results
cj
Kiki
cj
Thanks
the version that is better for me, may not be the better for you, we all have different requirements
king
Please I need assistence with widget-tweaks package
king
I have installed it and added it to my installed apps, I also loaded it into my html template but I KEEP on getting this exception...
king
.... File "/Library/Pcdev/DJANGO/FrameFusion/venv/lib/python3.11/site-packages/widget_tweaks/templatetags/widget_tweaks.py", line 50, in set_attr
return _process_field_attributes(field, attr, process)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Pcdev/DJANGO/FrameFusion/venv/lib/python3.11/site-packages/widget_tweaks/templatetags/widget_tweaks.py", line 28, in _process_field_attributes
old_as_widget = field.as_widget
^^^^^^^^^^^^^^^
AttributeError: 'BoundWidget' object has no attribute 'as_widget'
ruthless
Hello, I have a question. How can i create file cookie with JavaScript or just with django and how to add expire
Charly
ruthless
Charly
You want to set cookies with django? So not a "file cookie"?
ruthless
yes I want to set cookie but I don't know how to create it, they have much way to set cookie, in stackoverflow they created with JavaScript not with django they didn't use set_cookie() function
Question in stackoverflow was "How add to cart without login or register"
ruthless
Do you have answer for this question? and what do you know about set cookie
clouded
Alex
how to use i18n, which I use for localization in Django for plug-in JS scripts?
Charly
Can you explain in a detailed way what do you mean?
Shital
Hello I have one question could you guy's help me with that
Shital
I'm getting an error after applying migration command...it's says no migration to apply...I tried everything
𝙰𝚜𝚑𝚠𝚒𝚗
🏅♐Mark
Hii I have a model class name tickets so I want to pass the model field variable to the razorpay payment script code anyone please tell how to do that
🏅♐Mark
I tried many methods to pass after that shows
Json serilizer error
The Inspired
show code
🏅♐Mark
Ok wait please
S
I need help with django python project
S
Can anyone help
S
When I run the code my landing page keeps loading
🏅♐Mark
Abhishek
Yazdan
Hello, I am weak for Python object orientation, no one has anything
Khaled
Baraa
hi , i have a question , i have created my django for backend and react for front end , but i cannot fetch the api that written in django using react (the web page is empty dont have any elements but when i open the api the elements will appear)
Anonymous
Anonymous
Baraa
yes
Developer
Hello everyone. I have a question. I was deploying the Django REST Framework project to Vercel and I got this error
note
This Serverless Function has crashed.
Your connection is working correctly.
Vercel is working correctly.
500: INTERNAL_SERVER_ERROR
Code: FUNCTION_INVOCATION_FAILED
ID: arn1::4l5b8-1716555673350-0e7d1803627a
If you are a visitor, contact the website owner or try again later.
If you are the owner, learn how to fix the error and check the logs.
Anonymous
yes
Then did you set correct api url when building react?
Anonymous
Baraa
Anonymous
yep
Did you check via chrome developer tools?
Baraa
Baraa
Anonymous
200 / ok
Can you show me scripts?
Developer
LAMBDA_WARNING: Unhandled exception. The most likely cause is an issue in the function code. However, in rare cases, a Lambda runtime update can cause unexpected function behavior. For functions using managed runtimes, runtime updates can be triggered by a function change, or can be applied automatically. To determine if the runtime has been updated, check the runtime version in the INIT_START log entry. If this error correlates with a change in the runtime version, you may be able to mitigate this error by temporarily rolling back to the previous runtime version. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/runtimes-update.html [ERROR] Runtime.ImportModuleError: Unable to import module 'vc__handler__python': No module named 'pkg_resources' Traceback (most recent call last):
Developer
Baraa
const App = () => {
const [books, setBooks] = useState([]);
const [selectedType, setSelectedType] = useState('');
const [filteredBooks, setFilteredBooks] = useState([]);
useEffect(() => {
axios.get('http://127.0.0.1:8000/api/books')
.then(response => response.data)
.then(data => setBooks(data));
}, []);
this is the code in react , and this result in http://127.0.0.1:8000/api/books [
{
"title": "Big Bountry Bootcamp",
"author": "Baraa Abdulrahman Mutlaq",
"edition": 1,
"publication": "2024-05-21",
"file": "/media/books/Bug_Bounty_Bootcamp.pdf",
"image": "/media/books/Screenshot_2024-05-19_140809.png"
}
]
NK TRIPLLE
const App = () => {
const [books, setBooks] = useState([]);
const [selectedType, setSelectedType] = useState('');
const [filteredBooks, setFilteredBooks] = useState([]);
useEffect(() => {
axios.get('http://127.0.0.1:8000/api/books')
.then(response => response.data)
.then(data => setBooks(data));
}, []);
this is the code in react , and this result in http://127.0.0.1:8000/api/books [
{
"title": "Big Bountry Bootcamp",
"author": "Baraa Abdulrahman Mutlaq",
"edition": 1,
"publication": "2024-05-21",
"file": "/media/books/Bug_Bounty_Bootcamp.pdf",
"image": "/media/books/Screenshot_2024-05-19_140809.png"
}
]
it's ok you have data and you can render your component using that data
If the data has not been received after all, check that the cors are specified correctly
Baraa
🏅♐Mark
🏅♐Mark
How to solve the error brother
🏅♐Mark
🏅♐Mark
🏅♐Mark
Дмитрий
Developer
Developer
requirements.txt
Django==5.0.4
django-ckeditor==6.7.1
django-filter==24.2
djangorestframework==3.15.1
djangorestframework-simplejwt==5.3.1
drf-yasg==1.21.7
pillow==10.3.0
python-dotenv==1.0.1
whitenoise==6.6.0
setuptools
Developer
build_files.sh
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py collectstatic
Developer
vercel.json
{
"version": 2,
"builds": [
{ "src": "config/wsgi.py", "use": "@vercel/python", "config": { "maxLambdaSize": "15mb", "runtime": "python3.9"}},
{ "src": "staticfiles/**/*", "use": "@vercel/static" }
],
"routes": [
{ "src": "/static/(.*)", "dest": "/static/$1" },
{ "src": "/media/(.*)", "dest": "/media/$1" },
{ "src": "/(.*)", "dest": "config/wsgi.py" }
]
}
V
hello everyone, does anyone know how to output data from the database to a pdf file to create a document??
Joseph 🇬🇭
Hi I used the native Django Email Verification package for my sign up page. The verification email sends alright but my page goes to “error:Anonymous user”
Any help?
Дмитрий