Muflone
click the link on the third line
Driptamine
is that it? https://github.com/django/django/tree/main/django/conf/project_template
Muflone
yeah
Driptamine
bless you
Muflone
😀
Driptamine
i will find a way to thank you
~Ronnie
I'm writing unit tests for Django REST APIs I have developed that I'm planning to integrate to a CI/CD pipeline which will rebuild a docker instance running on production to update the codebase with new changes. I'm using pytest to write the unit test. The API endpoints require an access token for the APIClient to test the endpoints. I'm creating a test user and storing the access token as a global variable to be used by other test functions to authenticate.
~Ronnie
SInce I can't send a snapshot, anyone with leads on how I can ensure the access token is added to authenticate each request accordingly so that the tests run fine, kindly send tips or a solution I could use to solve the error I'm having.
Jimmies San
I'm writing unit tests for Django REST APIs I have developed that I'm planning to integrate to a CI/CD pipeline which will rebuild a docker instance running on production to update the codebase with new changes. I'm using pytest to write the unit test. The API endpoints require an access token for the APIClient to test the endpoints. I'm creating a test user and storing the access token as a global variable to be used by other test functions to authenticate.
so, about making a test user and saving the access token as a global var, it's usually better to keep tests separate and not share info/state between them. tests should do their thing without depending on what happened before and/or after. instead of using a global var tho, you could think about getting the access token in each test or (even better) using fixtures in pytest to set up the test environment. much cleaner in this way.
Prashant
TemplateDoesNotExist at / index.html Request Method: GET Request URL: *************#i am hiding this detail Django Version: 4.1.7 Exception Type: TemplateDoesNotExist Exception Value: index.html Exception Location: /var/www/Verantes_site/mb/lib/python3.10/site-packages/django/template/loader.py, line 19, in get_template Raised during: Showcase.views.home Python Executable: /var/www/Verantes_site/mb/bin/python Python Version: 3.10.12 Python Path: ['/var/www/Verantes_site', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/var/www/Verantes_site/mb/lib/python3.10/site-packages'] Server time: Wed, 03 Jan 2024 13:08:21 +0530
Prashant
this error is giving in live production
Prashant
can someone please help me out
Prashant
is there compulsorily we have to make index.html instead of home.html file in template?
Prashant
Why it would be home.html?
i did't make index.html
Prashant
You can put template folder properly in your project
i have done it properly but then also it giving this error
Prashant
can i make it?
Charly
can i make it?
Why don't you try it ?
Prashant
okay
Prashant
any other soln?
Rutya
And setting file add template
Charly
any other soln?
Why youw ant another solution when you havent tried the solution that works?
Rutya
So you can check your view file properly redirect html
Prashant
TemplateDoesNotExist at / index.html Request Method: GET Request URL: *************#i am hiding this detail Django Version: 4.1.7 Exception Type: TemplateDoesNotExist Exception Value: index.html Exception Location: /var/www/Verantes_site/mb/lib/python3.10/site-packages/django/template/loader.py, line 19, in get_template Raised during: Showcase.views.home Python Executable: /var/www/Verantes_site/mb/bin/python Python Version: 3.10.12 Python Path: ['/var/www/Verantes_site', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/var/www/Verantes_site/mb/lib/python3.10/site-packages'] Server time: Wed, 03 Jan 2024 13:08:21 +0530
Prashant
admin design-gallery.html js.html otppage.html wordrobe.html barkitchen.html footer.html login.html signup.html contact.html header.html loginotp.html thanku.html css.html index.html modular-kitchen.html vanity-units.html
Prashant
this is my all templates
Believe
i am getting same error
It means the path is not correct
Believe
Check your path to the templates
Prashant
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR,'Templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ]
Prashant
is this correct?
Prashant
okay i'm trying this
Prashant
and then let you know
Ibrokhim
import firebase_admin from firebase_admin import credentials, firestore cred = credentials.Certificate("serviceAccountKey.json") firebase_admin.initialize_app(cred) db = firestore.client() data = {'name': "Ibrokhim", "age": 1} db.collection('persons').add(data) Error: raise exceptions.RetryError( google.api_core.exceptions.RetryError: Deadline of 60.0s exceeded while calling target function, last exception: 503 Getting metadata from plugin failed with error: ('invalid_grant: Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim.', {'error': 'invalid_grant', 'error_description': 'Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim.'}) Hello. I tried to connect google firestore through Python. I don't understand it's giving me an error
Prashant
Thanks boss
Danish
👍
Alma
Hey guys! Someone knows why in Chrome I have csrf forbidden problem
Максим
Hey guys! Someone knows why in Chrome I have csrf forbidden problem
# settings.py CSRF_TRUSTED_ORIGINS = ['your-domain.com']
Anurag K
I want to perform automatic logout of the user when the admin block the user from the admin side django please anybody help
Believe
And check if user is inactive log out him
Mahan
hello guys i learned drf and i created a api for blog how to send this api for front? how to make json for front?
Zion
you mean how to consume the api endpoint by the front? its not the place
Mahan
i know bakend must send data for front with api but i dont know how?
clouded
i know bakend must send data for front with api but i dont know how?
The frontend requests the data from the backend. The backend does not initiate the connection, just responds to a request. And you should move this conversation to @pythonofftopic.
Muflone
well how?
this is a Django group learn html and js and you'll learn how to do requests to your backend
Mahan
tanks all
Zion
backend is just a prettier way to handle data using interfaces without touching to the data source, you need to study more about your frontend framework, and you will understand quickly.
Mahmuod
Hi I wanted to know how I can structure api with django
Mahmuod
Any guide’s??
Mirco
Any guide’s??
Django for APIs book
Mahmuod
Django for APIs book
is it beginners friendly??
Becky
Hi guys how can I link my Django model to the react app and map in it
Becky
And is thet the right way
Becky
Danish
Hi guys how can I link my Django model to the react app and map in it
Use Django Rest Framework to create API and consume it in react
Becky
Do you have a pdf
Doragonsureiyā
Do you have a pdf
Are you looking for Django REST Framework documentation? Here you have it: https://www.django-rest-framework.org/
Becky
Thank you 😊
_untold_._mystery_
How to create Database based django admin for multiple database with same model
Mirco
Yeah
_untold_._mystery_
What to do