What Django admin theme do you use ?
We happily use Django in our company and the plan is that our Key Account Managers will be responsible to manage their customer accounts.
But the feedback I get a lot is that Django admin is scary.
It looks complex with its small button and old school look.
So I want to theme it to make it less scary.
I really like Jolie as a theme, but looking at their website, it looks dead to me. They are asking for 200$ for a beta licence, alongside a button to get notified when it gets live. And I think it's been like this for a year.
So what have you guys implemented to make Django admin less scary for non tech administrators ?
Thanks a lot.
/r/django
https://redd.it/108d79r
We happily use Django in our company and the plan is that our Key Account Managers will be responsible to manage their customer accounts.
But the feedback I get a lot is that Django admin is scary.
It looks complex with its small button and old school look.
So I want to theme it to make it less scary.
I really like Jolie as a theme, but looking at their website, it looks dead to me. They are asking for 200$ for a beta licence, alongside a button to get notified when it gets live. And I think it's been like this for a year.
So what have you guys implemented to make Django admin less scary for non tech administrators ?
Thanks a lot.
/r/django
https://redd.it/108d79r
reddit
What Django admin theme do you use ?
We happily use Django in our company and the plan is that our Key Account Managers will be responsible to manage their customer accounts. But...
Django authentication works locally but not in PaaS cloud server
I have deployed a Django/Django Rest Framework application to Render and it works well except for the authentication process. I am using PostgreSQL for the database.
​
Authentication is based on Django sessions, and it works in my local server but not in Render, where it returns a 500 server error when trying to log in with some user credentials.
All the other database interactions and APIs work in Render, including registering users in the database. I guess there is some server configuration problem.
​
Any idea about how to solve this?
/r/django
https://redd.it/108lhru
I have deployed a Django/Django Rest Framework application to Render and it works well except for the authentication process. I am using PostgreSQL for the database.
​
Authentication is based on Django sessions, and it works in my local server but not in Render, where it returns a 500 server error when trying to log in with some user credentials.
All the other database interactions and APIs work in Render, including registering users in the database. I guess there is some server configuration problem.
​
Any idea about how to solve this?
/r/django
https://redd.it/108lhru
reddit
Django authentication works locally but not in PaaS cloud server
I have deployed a Django/Django Rest Framework application to Render and it works well except for the authentication process. I am using...
spam prevention in contact form issues
I cant use django re captcha. Is not working the import from captcha.fields
Simple-captcha didnt do the vallidations.
I'm thinking i should make a custom Anti spam for My contact form. Something like a simple math question in jpg.
But i would like to have Something more professional.
There ls another library or anyone allready have My problem and could solve it?
Thanks
/r/django
https://redd.it/108cxov
I cant use django re captcha. Is not working the import from captcha.fields
Simple-captcha didnt do the vallidations.
I'm thinking i should make a custom Anti spam for My contact form. Something like a simple math question in jpg.
But i would like to have Something more professional.
There ls another library or anyone allready have My problem and could solve it?
Thanks
/r/django
https://redd.it/108cxov
reddit
spam prevention in contact form issues
I cant use django re captcha. Is not working the import from captcha.fields Simple-captcha didnt do the vallidations. I'm thinking i should make...
Best practise to save timezone
So, I'm workin on a project based on USA, and they only need UTC -5 timezone.
which one is the best practise to save time in a DB:
Save it as UTC-5
Save it as UTC-0 and make a conversion when displaying on frontend
/r/django
https://redd.it/108agj9
So, I'm workin on a project based on USA, and they only need UTC -5 timezone.
which one is the best practise to save time in a DB:
Save it as UTC-5
Save it as UTC-0 and make a conversion when displaying on frontend
/r/django
https://redd.it/108agj9
reddit
Best practise to save timezone
So, I'm workin on a project based on USA, and they only need UTC -5 timezone. which one is the best practise to save time in a DB: * Save...
Problem with "unique" values
I'm currently working on my project and it has some values as *unique* and these values are being handled in an overwritten *get\_queryset* function and it is as follows:
```
def get_queryset(self):
data = self.request.data
categories = {
"carpet" : Flow.carpet,
"furniture" : Flow.furniture,
"eyewear" : Flow.eyewear,
"home" : Flow.home,
"shoe" : Flow.shoe,
"beauty" : Flow.beauty,
"accessories" : Flow.accessories,
"video" : Flow.video
}
if data['usdz_file']:
project = Project.objects.create(name = data['name'], poster = data['poster'], glb_file =
/r/django
https://redd.it/108mifu
I'm currently working on my project and it has some values as *unique* and these values are being handled in an overwritten *get\_queryset* function and it is as follows:
```
def get_queryset(self):
data = self.request.data
categories = {
"carpet" : Flow.carpet,
"furniture" : Flow.furniture,
"eyewear" : Flow.eyewear,
"home" : Flow.home,
"shoe" : Flow.shoe,
"beauty" : Flow.beauty,
"accessories" : Flow.accessories,
"video" : Flow.video
}
if data['usdz_file']:
project = Project.objects.create(name = data['name'], poster = data['poster'], glb_file =
/r/django
https://redd.it/108mifu
reddit
Problem with "unique" values
I'm currently working on my project and it has some values as *unique* and these values are being handled in an overwritten *get\_queryset*...
Wednesday Daily Thread: Beginner questions
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/108phia
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/108phia
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
PEP 703 – Making the Global Interpreter Lock Optional in CPython
https://peps.python.org/pep-0703/
/r/Python
https://redd.it/108l3mu
https://peps.python.org/pep-0703/
/r/Python
https://redd.it/108l3mu
Python Enhancement Proposals (PEPs)
PEP 703 – Making the Global Interpreter Lock Optional in CPython | peps.python.org
CPython’s global interpreter lock (“GIL”) prevents multiple threads from executing Python code at the same time. The GIL is an obstacle to using multi-core CPUs from Python efficiently. This PEP proposes adding a build configuration (--disable-gil) to...
cannot import name 'Bootstrap5' from 'flask_bootstrap'?
Link to my stackoverflow question https://stackoverflow.com/questions/75071790/cannot-import-name-bootstrap5-from-flask-bootstrap
/r/flask
https://redd.it/108cb5x
Link to my stackoverflow question https://stackoverflow.com/questions/75071790/cannot-import-name-bootstrap5-from-flask-bootstrap
/r/flask
https://redd.it/108cb5x
Stack Overflow
cannot import name 'Bootstrap5' from 'flask_bootstrap'?
I am trying to import Bootstrap5 from flask_bootstrap in my Python code on a Mac M1 using Python3. However, I get an import error saying that the name Bootstrap5 cannot be imported from flask_boots...
Render **context as HTML in render_template?
Hello everyone! I'm in the early stages of developing a flashcard solution using Flask. The objective is to have users input HTML for both sides of their flashcards, which will then be rendered when reviewing cards. As a foundation, I have been attempting to develop a simple Flask application that takes an input and parrots it back, rendered as HTML.
I have encountered an issue in that when I return e.g. `flask.render_template("index.html", front="<h1>Hello World</h1>")` on a GET request, `front` here is shown as pure text (escaping tags) as opposed to being rendered as HTML. In other words, instead of a large "Hello World", it displays "<h1>Hello World</h1>".
Example code follows:
# main.py
import flask
app = flask.Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
if flask.request.method == "POST":
return flask.render_template("index.html", front=flask.request.form["front"])
return flask.render_template("index.html", front="Enter something!")
/r/flask
https://redd.it/108h529
Hello everyone! I'm in the early stages of developing a flashcard solution using Flask. The objective is to have users input HTML for both sides of their flashcards, which will then be rendered when reviewing cards. As a foundation, I have been attempting to develop a simple Flask application that takes an input and parrots it back, rendered as HTML.
I have encountered an issue in that when I return e.g. `flask.render_template("index.html", front="<h1>Hello World</h1>")` on a GET request, `front` here is shown as pure text (escaping tags) as opposed to being rendered as HTML. In other words, instead of a large "Hello World", it displays "<h1>Hello World</h1>".
Example code follows:
# main.py
import flask
app = flask.Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
if flask.request.method == "POST":
return flask.render_template("index.html", front=flask.request.form["front"])
return flask.render_template("index.html", front="Enter something!")
/r/flask
https://redd.it/108h529
reddit
Render **context as HTML in render_template?
Posted in r/flask by u/Ok_Refrigerator9768 • 3 points and 3 comments
how do i pass a parameter to js function in flask ?
Hello all, i am a python beginner trying to make a portfolio website using flask to show some visualization i created using power bi .
i have followed the MSFT example to apply embedded 1 vis following the example but i am struggling to embedded multiple vis as i not yet able to find a way to pass a variable to to js so that it can embedded the other vis .
The place "VAR" is originally coded as 0 in the MSFT example it make the page only show the first report i have in the list of report id .
I need to assign a value for var (like 0 , 1,2 ,3 for 1st 2nd , 3rd , 4th report) for different "section tag" to extract the corresponding report but i don't know how .
Thank you
mypage.html
`{% extends "template.html" %}{% block title %}mypage{% endblock %}{% block content %}<section id="report-container" class="embed-container col-lg-offset-4 col-lg-7 col-md-offset-5 col-md-7 col-sm-offset-5 col-sm-7 mt-5"></section>{% endblock %}`
`{% block footer %}<br>{% endblock %}`
​
index.js inside static (edited to include the whole js function which include the .ajax method
`$(function () {`
`var reportContainer = $("#report-container").get(0);`
`$.ajax({`
`type: "GET",`
`url: "/getembedinfo",`
`dataType:
/r/flask
https://redd.it/108jcja
Hello all, i am a python beginner trying to make a portfolio website using flask to show some visualization i created using power bi .
i have followed the MSFT example to apply embedded 1 vis following the example but i am struggling to embedded multiple vis as i not yet able to find a way to pass a variable to to js so that it can embedded the other vis .
The place "VAR" is originally coded as 0 in the MSFT example it make the page only show the first report i have in the list of report id .
I need to assign a value for var (like 0 , 1,2 ,3 for 1st 2nd , 3rd , 4th report) for different "section tag" to extract the corresponding report but i don't know how .
Thank you
mypage.html
`{% extends "template.html" %}{% block title %}mypage{% endblock %}{% block content %}<section id="report-container" class="embed-container col-lg-offset-4 col-lg-7 col-md-offset-5 col-md-7 col-sm-offset-5 col-sm-7 mt-5"></section>{% endblock %}`
`{% block footer %}<br>{% endblock %}`
​
index.js inside static (edited to include the whole js function which include the .ajax method
`$(function () {`
`var reportContainer = $("#report-container").get(0);`
`$.ajax({`
`type: "GET",`
`url: "/getembedinfo",`
`dataType:
/r/flask
https://redd.it/108jcja
reddit
how do i pass a parameter to js function in flask ?
Hello all, i am a python beginner trying to make a portfolio website using flask to show some visualization i created using power bi . i have...
there any way to run functions?
I actually I created a file sharing website, unlike other file sharing website, my frontpage unable to show file preview in small boxed preview. How to achieve it?
And
Is there any way to fun python functions in jinja template?
/r/flask
https://redd.it/108hdda
I actually I created a file sharing website, unlike other file sharing website, my frontpage unable to show file preview in small boxed preview. How to achieve it?
And
Is there any way to fun python functions in jinja template?
/r/flask
https://redd.it/108hdda
reddit
there any way to run functions?
I actually I created a file sharing website, unlike other file sharing website, my frontpage unable to show file preview in small boxed preview....
Is it good way to send request whenever model update?
I have to post model data to some websites whenever specific columns of models changed.
1) write request function as override model update function.
2) add a function and use it in the view class.
If I apply 1), I don't need to check when I should add a new function to send requests or not. It'll work well whenever the model changes in every function. But It seems pretty dangerous..
2) I should write the code if I add a new function to handle the model. So if I miss writing the function, that'll not send a post request.
which is the better way..? Should I make a function to send a request? or override the update function in the model?
/r/django
https://redd.it/108zhxa
I have to post model data to some websites whenever specific columns of models changed.
1) write request function as override model update function.
2) add a function and use it in the view class.
If I apply 1), I don't need to check when I should add a new function to send requests or not. It'll work well whenever the model changes in every function. But It seems pretty dangerous..
2) I should write the code if I add a new function to handle the model. So if I miss writing the function, that'll not send a post request.
which is the better way..? Should I make a function to send a request? or override the update function in the model?
/r/django
https://redd.it/108zhxa
reddit
Is it good way to send request whenever model update?
I have to post model data to some websites whenever specific columns of models changed. 1) write request function as override model update...
Why or why not use AWS Lambda instead of a web framework for your REST APIs? (Business projects)
Hey guys! Im going to start a new project at work with a microservice architecture and I've been reading about AWS Lambda and I want to know why or why not use Lambda instead a web framework (Django, Flask; FastAPI, etc.)
/r/Python
https://redd.it/1092py3
Hey guys! Im going to start a new project at work with a microservice architecture and I've been reading about AWS Lambda and I want to know why or why not use Lambda instead a web framework (Django, Flask; FastAPI, etc.)
/r/Python
https://redd.it/1092py3
reddit
Why or why not use AWS Lambda instead of a web framework for your...
Hey guys! Im going to start a new project at work with a microservice architecture and I've been reading about AWS Lambda and I want to know why...
Easy euclidean algorithm to find gcd Python
There is only 2 lines of code.
def euc(a,b,x,y):print(f"{a} = {a // b} * {b} + {a % b}");return euc(b,a%b,x,y) if a%b else "\\n"+f'\\033[2;30;42m gcd({x}, {y}) = {str(b)} \\033[0;0m'
a,b=int(input("Num1: ")),int(input("Num2: "));print("");print(euc(a,b,a,b))
/r/Python
https://redd.it/10940rc
There is only 2 lines of code.
def euc(a,b,x,y):print(f"{a} = {a // b} * {b} + {a % b}");return euc(b,a%b,x,y) if a%b else "\\n"+f'\\033[2;30;42m gcd({x}, {y}) = {str(b)} \\033[0;0m'
a,b=int(input("Num1: ")),int(input("Num2: "));print("");print(euc(a,b,a,b))
/r/Python
https://redd.it/10940rc
reddit
Easy euclidean algorithm to find gcd Python
There is only 2 lines of code. def euc(a,b,x,y):print(f"{a} = {a // b} \* {b} + {a % b}");return euc(b,a%b,x,y) if a%b else...
Best resources to learn Django
Hi,
in the past I only used Flask and I like it a lot. But I thought I will try Django too because it might get me to working applications faster.
What are some good resources to learn the newest Django version?
Most of the stuff I found isn't up to date and maybe you got some recommendations for me.
/r/django
https://redd.it/10998rz
Hi,
in the past I only used Flask and I like it a lot. But I thought I will try Django too because it might get me to working applications faster.
What are some good resources to learn the newest Django version?
Most of the stuff I found isn't up to date and maybe you got some recommendations for me.
/r/django
https://redd.it/10998rz
reddit
Best resources to learn Django
Hi, in the past I only used Flask and I like it a lot. But I thought I will try Django too because it might get me to working applications...
Run Celery tasks on Railway
I deployed a Django project in Railway, and it uses Celery and Redis to perform an scheduled task. The project is successfully online, but the Celery tasks are not performed.
If I execute the Celery worker from my computer's terminal using the Railway CLI, the tasks are performed as expected, and the results are saved in the Railway's PostgreSQL, and thus those results are displayed in the on-line site. Also, the redis server used is also the one from Railway.
However, Celery is operating in 'local'. I need the Celery tasks to be performed without my pc's terminal doing it. This is the log showing the Celery is running local, and the Redis server is the one up in Railway:
-------------- celery@MacBook-Pro-de-Corey.local v5.2.7 (dawn-chorus)
--- -----
-- ---- macOS-13.1-arm64-arm-64bit 2023-01-11 23:08:34
- --- ---
- ---------- config
- ---------- .> app: suii:0x1027e86a0
- ---------- .> transport: redis://default:@containers-us-west-28.railway.app:7078//
- ---------- .> results:
- --- --- .> concurrency: 10 (prefork)
/r/django
https://redd.it/1096phz
I deployed a Django project in Railway, and it uses Celery and Redis to perform an scheduled task. The project is successfully online, but the Celery tasks are not performed.
If I execute the Celery worker from my computer's terminal using the Railway CLI, the tasks are performed as expected, and the results are saved in the Railway's PostgreSQL, and thus those results are displayed in the on-line site. Also, the redis server used is also the one from Railway.
However, Celery is operating in 'local'. I need the Celery tasks to be performed without my pc's terminal doing it. This is the log showing the Celery is running local, and the Redis server is the one up in Railway:
-------------- celery@MacBook-Pro-de-Corey.local v5.2.7 (dawn-chorus)
--- -----
-- ---- macOS-13.1-arm64-arm-64bit 2023-01-11 23:08:34
- --- ---
- ---------- config
- ---------- .> app: suii:0x1027e86a0
- ---------- .> transport: redis://default:@containers-us-west-28.railway.app:7078//
- ---------- .> results:
- --- --- .> concurrency: 10 (prefork)
/r/django
https://redd.it/1096phz
reddit
Run Celery tasks on Railway
I deployed a Django project in Railway, and it uses Celery and Redis to perform an scheduled task. The project is successfully online, but the...
Architecture Setting up a structure/architecture for a constant crawling and data saving platform.
Our company's client has multiple websites to track if they're down or not. And the CEO of our company wants us to build a new platform that constantly crawls the inserted websites and pings the user in the platform.
In our old system, the previous developer team used API's to save data coming from the crawler. If you add 1000 of websites, 1000x5 API calls are happening in an specific time gap, which made the system slow. Also, we have added subdomain tracking on the system, with which the system became super slow. And, sending data through websockets in the frontend to update what's going on made the system super duper slow.
I have got the responsibility for making a robost system that is super fast. So, I am here asking the question of how can I make the system robost, and fast.
Where to host the crawler, should we call APIs to save data collected by the crawler? What's the most optimized solution for this?
/r/django
https://redd.it/1095ryn
Our company's client has multiple websites to track if they're down or not. And the CEO of our company wants us to build a new platform that constantly crawls the inserted websites and pings the user in the platform.
In our old system, the previous developer team used API's to save data coming from the crawler. If you add 1000 of websites, 1000x5 API calls are happening in an specific time gap, which made the system slow. Also, we have added subdomain tracking on the system, with which the system became super slow. And, sending data through websockets in the frontend to update what's going on made the system super duper slow.
I have got the responsibility for making a robost system that is super fast. So, I am here asking the question of how can I make the system robost, and fast.
Where to host the crawler, should we call APIs to save data collected by the crawler? What's the most optimized solution for this?
/r/django
https://redd.it/1095ryn
reddit
[Architecture] Setting up a structure/architecture for a constant...
Our company's client has multiple websites to track if they're down or not. And the CEO of our company wants us to build a new platform that...