Best login method for DRF
When using drfjwt do you write your login function or you make use of the provided jwt token login views, and which do you think is more efficient and advisable to use?
“also for those who posts coding related stuffs on IG I’ll love to follow you guys😊 0cisc is my username” .
/r/django
https://redd.it/10bme2f
When using drfjwt do you write your login function or you make use of the provided jwt token login views, and which do you think is more efficient and advisable to use?
“also for those who posts coding related stuffs on IG I’ll love to follow you guys😊 0cisc is my username” .
/r/django
https://redd.it/10bme2f
reddit
Best login method for DRF
When using drf_jwt do you write your login function or you make use of the provided jwt token login views, and which do you think is more...
django-auth-ldap warning
Hey guys, sorry if this isn't the right place to post this.
I have set up an LDAP backend for my organisation's internal website, but it is annoying to constantly receive warnings from it in the logs, particularly this one:
I have it so that on any LDAP login, the LDAP user.set_unusable_password() function is run, so this warning doesn't interest me at all. Is there a way I can specifically prevent this warning from being spammed when tens of people are regularly logging into the dev server, so I can't just turn off debug=True?
/r/django
https://redd.it/10bphpp
Hey guys, sorry if this isn't the right place to post this.
I have set up an LDAP backend for my organisation's internal website, but it is annoying to constantly receive warnings from it in the logs, particularly this one:
WARNING:django_auth_ldap:cn=REDACTED,ou=REDACTED,ou=REDACTED,dc=REDACTED,dc=REDACTED does not have a value for the attribute userPassword I have it so that on any LDAP login, the LDAP user.set_unusable_password() function is run, so this warning doesn't interest me at all. Is there a way I can specifically prevent this warning from being spammed when tens of people are regularly logging into the dev server, so I can't just turn off debug=True?
/r/django
https://redd.it/10bphpp
reddit
django-auth-ldap warning
Hey guys, sorry if this isn't the right place to post this. I have set up an LDAP backend for my organisation's internal website, but it is...
brew
Does anyone know how to solve this problem, I'm wanting to use heroku, but I can't:
To use the Heroku CLI's autocomplete --
Via homebrew's shell completion:
Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion
NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded
and called, either explicitly or via a framework like oh-my-zsh.
2) Then run
$ heroku autocomplete --refresh-cache
OR
Use our standalone setup:
Run and follow the install steps:
$ heroku autocomplete
Bash completion has been installed to:
/home/linuxbrew/.linuxbrew/etc/bash_completion.d
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/heroku/7.67.1: 22,567 files, 85.3MB, built in 6 seconds
==> Running `brew cleanup heroku`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
/r/django
https://redd.it/10bnrin
Does anyone know how to solve this problem, I'm wanting to use heroku, but I can't:
To use the Heroku CLI's autocomplete --
Via homebrew's shell completion:
Follow homebrew's install instructions https://docs.brew.sh/Shell-Completion
NOTE: For zsh, as the instructions mention, be sure compinit is autoloaded
and called, either explicitly or via a framework like oh-my-zsh.
2) Then run
$ heroku autocomplete --refresh-cache
OR
Use our standalone setup:
Run and follow the install steps:
$ heroku autocomplete
Bash completion has been installed to:
/home/linuxbrew/.linuxbrew/etc/bash_completion.d
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/heroku/7.67.1: 22,567 files, 85.3MB, built in 6 seconds
==> Running `brew cleanup heroku`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
/r/django
https://redd.it/10bnrin
Homebrew Documentation
brew Shell Completion
Documentation for the missing package manager for macOS (or Linux).
URL not working
Hi I am currently finding problems with the following in Django:
urls.py:
from django.urls import path;
from . import views;
urlpatterns = [
path('', views.index, name = "index"),
path('/mail/', views.sendmail, name = 'mail')
\]
​
views.py:
from django import forms;
from django.shortcuts import render;
from django.http import HttpResponseRedirect;
from django.core.mail import send_mail;
from django.urls import reverse;
class PythonForm(forms.Form):
sub = forms.CharField(label = "subject");
name = forms.CharField(label = "name");
email = forms.EmailField();
msg = forms.CharField(label = "message");
def index(request):
return render(request, "site7/site7.html");
def sendmail(request):
if request.method == "POST":
form1 = PythonForm(request.POST);
if form1.is_valid():
n = forms.CharField(label = "name");
email = forms.EmailField();
sub = forms.CharField(label = "subject");
msg = forms.CharField(label = "message");
send_mail(
subject = sub,
message = msg+"\\n Sincerely, \\n"+n,
from_email = email,
recipient_list= 'interest20century@gmail.com'
);
return HttpResponseRedirect(reverse("index"));
else:
return render(request, "site7/site7.html",{
"form": form1
/r/django
https://redd.it/10bu9z0
Hi I am currently finding problems with the following in Django:
urls.py:
from django.urls import path;
from . import views;
urlpatterns = [
path('', views.index, name = "index"),
path('/mail/', views.sendmail, name = 'mail')
\]
​
views.py:
from django import forms;
from django.shortcuts import render;
from django.http import HttpResponseRedirect;
from django.core.mail import send_mail;
from django.urls import reverse;
class PythonForm(forms.Form):
sub = forms.CharField(label = "subject");
name = forms.CharField(label = "name");
email = forms.EmailField();
msg = forms.CharField(label = "message");
def index(request):
return render(request, "site7/site7.html");
def sendmail(request):
if request.method == "POST":
form1 = PythonForm(request.POST);
if form1.is_valid():
n = forms.CharField(label = "name");
email = forms.EmailField();
sub = forms.CharField(label = "subject");
msg = forms.CharField(label = "message");
send_mail(
subject = sub,
message = msg+"\\n Sincerely, \\n"+n,
from_email = email,
recipient_list= 'interest20century@gmail.com'
);
return HttpResponseRedirect(reverse("index"));
else:
return render(request, "site7/site7.html",{
"form": form1
/r/django
https://redd.it/10bu9z0
How to deny user A from seeing content meant for user B
Hello!
I am following along Dennis Ivy's tutorial "Django To Do List App With User Registration & Login" (amazing content btw, definitely recommend for django beginners).
To give some context before my question - the project is set up so that each user has their to do list which is visible only for them:
class TaskListView(LoginRequiredMixin, ListView):
model = Task
contextobjectname = 'tasks'
def getcontextdata(self, kwargs):
context = super().getcontextdata(kwargs)
context'tasks' = context'tasks'.filter(user=self.request.user)
context'count' = context'tasks'.filter(completed=False).count()
return context
There is one thing though that wasn't properly solved - let's say we have 2 users: User A and User B. If I am logged in as User A, I can still access the
/r/django
https://redd.it/10bnj6t
Hello!
I am following along Dennis Ivy's tutorial "Django To Do List App With User Registration & Login" (amazing content btw, definitely recommend for django beginners).
To give some context before my question - the project is set up so that each user has their to do list which is visible only for them:
class TaskListView(LoginRequiredMixin, ListView):
model = Task
contextobjectname = 'tasks'
def getcontextdata(self, kwargs):
context = super().getcontextdata(kwargs)
context'tasks' = context'tasks'.filter(user=self.request.user)
context'count' = context'tasks'.filter(completed=False).count()
return context
There is one thing though that wasn't properly solved - let's say we have 2 users: User A and User B. If I am logged in as User A, I can still access the
/r/django
https://redd.it/10bnj6t
reddit
How to deny user A from seeing content meant for user B
Hello! I am following along Dennis Ivy's tutorial "Django To Do List App With User Registration & Login" (amazing content btw, definitely...
Django lists with models
Hi! I'm currently doing a course on Django and at the same time doing practice projects to learn the methods taught on the course. I have now learnt about models and I have one model called "Customer" which surprise surprise has customers in it. My app should log gym visits of these customers and that would be done with pythons datetime.now(), is it possible to include a list for the customer object that would update each visit to the object/model. So that it would be for example:
Customer:
name = "Mr X"
age="15"
visits=[01/02/2023, 01/05/2023, 01/08/2023\]
and then you could append these dates to this customer's model whenever he logged into the gym. Or what would be the best way to implement something like this?
/r/django
https://redd.it/10buss7
Hi! I'm currently doing a course on Django and at the same time doing practice projects to learn the methods taught on the course. I have now learnt about models and I have one model called "Customer" which surprise surprise has customers in it. My app should log gym visits of these customers and that would be done with pythons datetime.now(), is it possible to include a list for the customer object that would update each visit to the object/model. So that it would be for example:
Customer:
name = "Mr X"
age="15"
visits=[01/02/2023, 01/05/2023, 01/08/2023\]
and then you could append these dates to this customer's model whenever he logged into the gym. Or what would be the best way to implement something like this?
/r/django
https://redd.it/10buss7
Proxy Model
I've a model "Approval" and its inherited model "ApprovalType" where i have put proxy = True. In the Approval model I've this "type":
so when I'm creating the entries in the model using
/r/django
https://redd.it/10blk9u
I've a model "Approval" and its inherited model "ApprovalType" where i have put proxy = True. In the Approval model I've this "type":
type = models.CharField(max_length=30)so when I'm creating the entries in the model using
Approval.objects.create() my manager has asked me to (call the proxy model) or (create) the entries without actually putting type="abc" in the create(). I don't know how to this. please help me out on this/r/django
https://redd.it/10blk9u
reddit
Proxy Model
I've a model "Approval" and its inherited model "ApprovalType" where i have put proxy = True. In the Approval model I've this "type": `type =...
Need to restart the Kernel frequently
Basically the title. The Kernel dies to frequently. Any solution?
/r/JupyterNotebooks
https://redd.it/10bk5sf
Basically the title. The Kernel dies to frequently. Any solution?
/r/JupyterNotebooks
https://redd.it/10bk5sf
reddit
Need to restart the Kernel frequently
Basically the title. The Kernel dies to frequently. Any solution?
Cannot figure out how to get dictionary values to show up on the page
I am very new to Django, so please be patient if this is something trivial. I have been trying to figure out a way to solve it for hours.
The problem:
I have a json file that looks something like this:
{
"Estonia": {
"dialcode": "+372",
"countrycode": "EE",
"emoji": "🇪🇪",
"imageurl": "https://www.flagpictures.com/static/images/flags/ee.png",
"flagcolors":
"Blue",
"Black",
"White"
},
"Eswatini": {
/r/django
https://redd.it/10caeh1
I am very new to Django, so please be patient if this is something trivial. I have been trying to figure out a way to solve it for hours.
The problem:
I have a json file that looks something like this:
{
"Estonia": {
"dialcode": "+372",
"countrycode": "EE",
"emoji": "🇪🇪",
"imageurl": "https://www.flagpictures.com/static/images/flags/ee.png",
"flagcolors":
"Blue",
"Black",
"White"
},
"Eswatini": {
/r/django
https://redd.it/10caeh1
API response time
After clean instalation of django and django-rest-framework simple APIView that returns one serialized objects {id:1,name:"test"} has response time around 45ms. While FastAPI response time is around 10ms.
Why is that?
/r/django
https://redd.it/10c566t
After clean instalation of django and django-rest-framework simple APIView that returns one serialized objects {id:1,name:"test"} has response time around 45ms. While FastAPI response time is around 10ms.
Why is that?
/r/django
https://redd.it/10c566t
reddit
API response time
After clean instalation of django and django-rest-framework simple APIView that returns one serialized objects {id:1,name:"test"} has response...
Is there an platform dedicated to deploy django application like laravel Forge ?
Hi,
I have been using django since many years now and i always wonder if there was a platform that could be use to deploy a django project without pain and followong the same process regardless of where it's deployed.
I mean if you deploy on AWS ECS the process is different than on Digital Ocean, even if you are using Docker. So I thought maybe there is a platform providing such service, so i can deploy any of my project and client's project very quicly and easily.
/r/django
https://redd.it/10avt4h
Hi,
I have been using django since many years now and i always wonder if there was a platform that could be use to deploy a django project without pain and followong the same process regardless of where it's deployed.
I mean if you deploy on AWS ECS the process is different than on Digital Ocean, even if you are using Docker. So I thought maybe there is a platform providing such service, so i can deploy any of my project and client's project very quicly and easily.
/r/django
https://redd.it/10avt4h
reddit
Is there an platform dedicated to deploy django application like...
Hi, I have been using django since many years now and i always wonder if there was a platform that could be use to deploy a django project...
A tutorial for class based views user registration with email verification?
/r/django
https://redd.it/10avecz
/r/django
https://redd.it/10avecz
reddit
A tutorial for class based views user registration with email...
Posted in r/django by u/KhZaym • 0 points and 3 comments
Django (Both in backend and frontend) or Django Rest Framework + React?
I would like to develop a website (like Zillow) by myself and I don't know if it would be easier to do it using only Django (with Django templates and vanilla Javascript for functionality and interactivity) or Django Rest Framework and React.
I have experience in React but I do not enjoy writing a separate backend and frontend. Also I don't like React that much. Is it possible, easier and better for only one dev to use only Django for a project like that?
/r/django
https://redd.it/10ai8h7
I would like to develop a website (like Zillow) by myself and I don't know if it would be easier to do it using only Django (with Django templates and vanilla Javascript for functionality and interactivity) or Django Rest Framework and React.
I have experience in React but I do not enjoy writing a separate backend and frontend. Also I don't like React that much. Is it possible, easier and better for only one dev to use only Django for a project like that?
/r/django
https://redd.it/10ai8h7
reddit
Django (Both in backend and frontend) or Django Rest Framework +...
I would like to develop a website (like Zillow) by myself and I don't know if it would be easier to do it using only Django (with Django ...
Django AWS S3 image files working locally but not in production
I'm creating a website with a blog that allows users to upload their own profile pictures, and this works locally. However, in deployment on OpenShift it returns an error ' The requested resource was not found on this server.'
​
My code in settings:
​
MEDIAROOT = os.path.join(BASEDIR, 'media')
MEDIAURL = '/media/'
AWSACCESSKEYID = 'xxx'
AWSSECRETACCESSKEY = 'xxx'
AWSSTORAGEBUCKETNAME = 'xxx'
AWSS3REGIONNAME = 'eu-west-2'
AWSS3ADDRESSINGSTYLE = "virtual"
AWSS3SIGNATUREVERSION = 's3v4'
AWSS3FILEOVERWRITE = False
AWSDEFAULTACL = None
DEFAULTFILESTORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
Locally, the link to an example image is: https://personal-portfolio-website-files.s3.amazonaws.com/profile\_pics/dog.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA5HK62K4UKN4EU6UQ%2F20230111%2Feu-west-2%2Fs3%2Faws4\_request&X-Amz-Date=20230111T120246Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=7ca52e78c5c266d18d24d4fc1bdb6ddb22267d06c09ba3eae1f6853fba7f1b91
​
Whereas on OpenShift, it's: http://personal-portfolio-web-personal-portfolio.apps.openshift.cs.cf.ac.uk/media/profile\_pics/dog.jpg
​
Does anyone know what's causing this?
I've tried changing all the permissions of my bucket to allow everything.
/r/django
https://redd.it/1093i83
I'm creating a website with a blog that allows users to upload their own profile pictures, and this works locally. However, in deployment on OpenShift it returns an error ' The requested resource was not found on this server.'
​
My code in settings:
​
MEDIAROOT = os.path.join(BASEDIR, 'media')
MEDIAURL = '/media/'
AWSACCESSKEYID = 'xxx'
AWSSECRETACCESSKEY = 'xxx'
AWSSTORAGEBUCKETNAME = 'xxx'
AWSS3REGIONNAME = 'eu-west-2'
AWSS3ADDRESSINGSTYLE = "virtual"
AWSS3SIGNATUREVERSION = 's3v4'
AWSS3FILEOVERWRITE = False
AWSDEFAULTACL = None
DEFAULTFILESTORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
Locally, the link to an example image is: https://personal-portfolio-website-files.s3.amazonaws.com/profile\_pics/dog.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA5HK62K4UKN4EU6UQ%2F20230111%2Feu-west-2%2Fs3%2Faws4\_request&X-Amz-Date=20230111T120246Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=7ca52e78c5c266d18d24d4fc1bdb6ddb22267d06c09ba3eae1f6853fba7f1b91
​
Whereas on OpenShift, it's: http://personal-portfolio-web-personal-portfolio.apps.openshift.cs.cf.ac.uk/media/profile\_pics/dog.jpg
​
Does anyone know what's causing this?
I've tried changing all the permissions of my bucket to allow everything.
/r/django
https://redd.it/1093i83
Django Knox login endpoint not working
I used files from "https://github.com/Omkar0231/Django-Login-API" with no change. But, the login request from Postman is resulting in error, "detail": "JSON parse error - Expecting value: line 1 column 1 (char 0)", while the terminal shows "Bad request...".
The source code developer in above git also explained it in a video, "https://www.youtube.com/watch?v=6d0fiPj0dsA", however, in video everything seems to be working as expected.
Whatever I understood from Googling, I thought that a bearer token is to be included in the login request as header. But I don't know where to find the bearer token in my Django app. However, in the video, the original author/developer did not include any such header token for the login request from Postman.
Please help me figure out the issue.
/r/django
https://redd.it/108yj85
I used files from "https://github.com/Omkar0231/Django-Login-API" with no change. But, the login request from Postman is resulting in error, "detail": "JSON parse error - Expecting value: line 1 column 1 (char 0)", while the terminal shows "Bad request...".
The source code developer in above git also explained it in a video, "https://www.youtube.com/watch?v=6d0fiPj0dsA", however, in video everything seems to be working as expected.
Whatever I understood from Googling, I thought that a bearer token is to be included in the login request as header. But I don't know where to find the bearer token in my Django app. However, in the video, the original author/developer did not include any such header token for the login request from Postman.
Please help me figure out the issue.
/r/django
https://redd.it/108yj85
GitHub
GitHub - Omkar0231/Django-Login-API
Contribute to Omkar0231/Django-Login-API development by creating an account on GitHub.
Sunday Daily Thread: What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/10c4t91
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/10c4t91
reddit
Sunday Daily Thread: What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...
What are people using to organize virtual environments these days?
Thinking multiple Python versions and packages
Is Anaconda still a go to? Are there any better options in circulation that I could look into?
/r/Python
https://redd.it/10bxkjp
Thinking multiple Python versions and packages
Is Anaconda still a go to? Are there any better options in circulation that I could look into?
/r/Python
https://redd.it/10bxkjp
reddit
What are people using to organize virtual environments these days?
Thinking multiple Python versions and packages Is Anaconda still a go to? Are there any better options in circulation that I could look into?
Total beginner - Could Python be interesting for sales?
Hi there kind Python people.
Thank you for taking the time to read my question! It might be different to what normally gets posted in this sub. It's not about programming, but about career choices.
I am a 28 year old with a masters degree in Communication Sciences. Ever since finishing my studies I have been very interested in programming, AI, big data... Yet for the last years I preferred a life of travelling around and parties instead of really sharpening my skills. The time has really come for me to dedicate myself. I have taken up routines and discipline, and I have an ambitious mindset.
At this moment I am about to start a sales job (wholesale in medical disposables) in a very small but growth-oriented company. It is far from my dream job, but I want to view this as a very important step on my ladder. I want to learn a lot.
I believe there would be an awful lot to learn before it even could become useful, but as far as I understand what this language does it could come in handy for creating and managing databases of (potential) customers, sales histories, keeping track of inventory
/r/Python
https://redd.it/10c4o15
Hi there kind Python people.
Thank you for taking the time to read my question! It might be different to what normally gets posted in this sub. It's not about programming, but about career choices.
I am a 28 year old with a masters degree in Communication Sciences. Ever since finishing my studies I have been very interested in programming, AI, big data... Yet for the last years I preferred a life of travelling around and parties instead of really sharpening my skills. The time has really come for me to dedicate myself. I have taken up routines and discipline, and I have an ambitious mindset.
At this moment I am about to start a sales job (wholesale in medical disposables) in a very small but growth-oriented company. It is far from my dream job, but I want to view this as a very important step on my ladder. I want to learn a lot.
I believe there would be an awful lot to learn before it even could become useful, but as far as I understand what this language does it could come in handy for creating and managing databases of (potential) customers, sales histories, keeping track of inventory
/r/Python
https://redd.it/10c4o15
reddit
Total beginner - Could Python be interesting for sales?
Hi there kind Python people. Thank you for taking the time to read my question! It might be different to what normally gets posted in this sub....
Check out AWESOME PANEL SHARING - An easy to use sharing service for Panel data apps
In 2022 Pyodide and PyScript paved the way for Python in the Browser. On top of that, the data app framework Panel made it easy to panel convert your data app to run in the browser only.
On top of that I created AWESOME PANEL SHARING that is a easy to use sharing service for Panel data apps.
Check out the growing Gallery of inspirational examples.
Awesome Panel Sharing Gallery
Or share your data app with the world.
https://reddit.com/link/10cbt17/video/caafvw9595ca1/player
/r/Python
https://redd.it/10cbt17
In 2022 Pyodide and PyScript paved the way for Python in the Browser. On top of that, the data app framework Panel made it easy to panel convert your data app to run in the browser only.
On top of that I created AWESOME PANEL SHARING that is a easy to use sharing service for Panel data apps.
Check out the growing Gallery of inspirational examples.
Awesome Panel Sharing Gallery
Or share your data app with the world.
https://reddit.com/link/10cbt17/video/caafvw9595ca1/player
/r/Python
https://redd.it/10cbt17
GitHub
GitHub - holoviz/panel: Panel: The powerful data exploration & web app framework for Python
Panel: The powerful data exploration & web app framework for Python - holoviz/panel
(Maybe) Everything You'll Ever Need to Know about Python Imports and Project Structure
It isn’t that hard, but it is a well-kept secret. And for good reason. I’ve had a draft of this article in my head for months, but it wasn’t until I started using Poetry that I found a method I could explain in a two-minute read.
(Maybe) Everything You'll Ever Need to Know About Python Imports and Project Structure (foundationsafety.com)
/r/Python
https://redd.it/10c49jo
It isn’t that hard, but it is a well-kept secret. And for good reason. I’ve had a draft of this article in my head for months, but it wasn’t until I started using Poetry that I found a method I could explain in a two-minute read.
(Maybe) Everything You'll Ever Need to Know About Python Imports and Project Structure (foundationsafety.com)
/r/Python
https://redd.it/10c49jo
Foundation Safety
(Maybe) Everything You'll Ever Need to Know About Python Imports and Project Structure
Trade - Multipurpose Business & Corporate Jekyll Template Jekyll Theme For Mobile Apps Download Landing Page And Blogging.