url_for() generated dynamics link for routes and assets in js, css file?
so I want to request a route from js code which i am serving from static... is there no way to insert dynamically generated link in js code??
/r/flask
https://redd.it/13638ub
so I want to request a route from js code which i am serving from static... is there no way to insert dynamically generated link in js code??
/r/flask
https://redd.it/13638ub
Reddit
r/flask on Reddit: url_for() generated dynamics link for routes and assets in js, css file?
Posted by u/asking_for_a_friend0 - 1 vote and 1 comment
How should I send requests to another API using DRF?
Should I use requests built-in python library or there is a special instruments to send requests to another API in APIView class?
/r/djangolearning
https://redd.it/136d4kg
Should I use requests built-in python library or there is a special instruments to send requests to another API in APIView class?
/r/djangolearning
https://redd.it/136d4kg
Reddit
r/djangolearning on Reddit: How should I send requests to another API using DRF?
Posted by u/Tea-Stock - 2 votes and 6 comments
Wagtail CMS v5.0 released with Django 4.2 support, dark mode, SVG image support, customisable icons, always-on minimap and more
https://docs.wagtail.org/en/stable/releases/5.0.html
/r/django
https://redd.it/136h75q
https://docs.wagtail.org/en/stable/releases/5.0.html
/r/django
https://redd.it/136h75q
Reddit
r/django on Reddit: Wagtail CMS v5.0 released with Django 4.2 support, dark mode, SVG image support, customisable icons, always…
Posted by u/Dauros - 16 votes and no comments
Should I build Backend or Frontend first?
I'm using Django Rest Framework for the backend and React for the front-end.
Which should I build first for a Full-Stack project.
/r/django
https://redd.it/136lg76
I'm using Django Rest Framework for the backend and React for the front-end.
Which should I build first for a Full-Stack project.
/r/django
https://redd.it/136lg76
Reddit
r/django on Reddit: Should I build Backend or Frontend first?
Posted by u/Icy_Key19 - 3 votes and 12 comments
Best practice for model id/pk?
So I'm starting a new Django project, and I want to get this right.
What's the best practice for model IDs?
1.
2.
3. Just use the default auto-increment pk (i.e. not define any specific primary key field)
I'm leaning strongly towards 2, as I heard that it's impossible to get a collision, since UUID1 generates a UUID from timestamp.
Problem with 3 is that I might need to use it publicly, so sequential IDs are no bueno.
What is the best practice for this?
/r/django
https://redd.it/136c4qb
So I'm starting a new Django project, and I want to get this right.
What's the best practice for model IDs?
1.
id = models.UUIDField(default = uuid.uuid4, unique = True, primary_key = True)2.
id = models.UUIDField(default = uuid.uuid1, unique = True, primary_key = True)3. Just use the default auto-increment pk (i.e. not define any specific primary key field)
I'm leaning strongly towards 2, as I heard that it's impossible to get a collision, since UUID1 generates a UUID from timestamp.
Problem with 3 is that I might need to use it publicly, so sequential IDs are no bueno.
What is the best practice for this?
/r/django
https://redd.it/136c4qb
Reddit
r/django on Reddit: Best practice for model id/pk?
Posted by u/3kvn394 - 12 votes and 3 comments
[N] OpenLLaMA: An Open Reproduction of LLaMA
https://github.com/openlm-research/open_llama
> We train our models on the RedPajama dataset released by Together, which is a reproduction of the LLaMA training dataset containing over 1.2 trillion tokens. We follow the exactly same preprocessing steps and training hyperparameters as the original LLaMA paper, including model architecture, context length, training steps, learning rate schedule, and optimizer. The only difference between our setting and the original one is the dataset used: OpenLLaMA employs the RedPajama dataset rather than the one utilized by the original LLaMA.
/r/MachineLearning
https://redd.it/136exj2
https://github.com/openlm-research/open_llama
> We train our models on the RedPajama dataset released by Together, which is a reproduction of the LLaMA training dataset containing over 1.2 trillion tokens. We follow the exactly same preprocessing steps and training hyperparameters as the original LLaMA paper, including model architecture, context length, training steps, learning rate schedule, and optimizer. The only difference between our setting and the original one is the dataset used: OpenLLaMA employs the RedPajama dataset rather than the one utilized by the original LLaMA.
/r/MachineLearning
https://redd.it/136exj2
GitHub
GitHub - openlm-research/open_llama: OpenLLaMA, a permissively licensed open source reproduction of Meta AI’s LLaMA 7B trained…
OpenLLaMA, a permissively licensed open source reproduction of Meta AI’s LLaMA 7B trained on the RedPajama dataset - openlm-research/open_llama
Django security releases issued: 4.2.1, 4.1.9, and 3.2.19
https://www.djangoproject.com/weblog/2023/may/03/security-releases/
/r/django
https://redd.it/136k1gh
https://www.djangoproject.com/weblog/2023/may/03/security-releases/
/r/django
https://redd.it/136k1gh
Django Project
Django security releases issued: 4.2.1, 4.1.9, and 3.2.19
Posted by Mariusz Felisiak on May 3, 2023
Recommendations are not shown
**result.html**
`<!DOCTYPE html>`
`<html lang="en">`
`<head>`
`<meta charset="UTF-8">`
`<meta http-equiv="X-UA-Compatible" content="IE=edge">`
`<meta name="viewport" content="width=device-width, initial-scale=1.0">`
`<title>Result</title>`
`</head>`
`<body>`
`<h1>Result</h1>`
`<p id ="emotion">Emotion: {{ emotion }}</p>`
`<p id ="gender">Gender: {{ gender }}</p>`
`<button onclick="recommendation('{{ gender }}', '{{ emotion }}')">Recommendation</button>`
`<div id="suggested"></div>`
`<script>`
`window.onload = function() {`
`var gender = "{{ gender }}";`
`var emotion = "{{ emotion }}";`
`recommendation(gender, emotion);`
`document.getElementById("recommendBtn").addEventListener("click", function() {`
`recommendation(gender, emotion);`
`});`
`}`
`</script>`
`</body>`
`</html>`
[**app.py**](https://app.py)
`@app.route('/resultpage')`
`def resultpage():`
`gender = request.args.get('gender')`
`emotion = request.args.get('emotion')`
`return render_template('result.html', gender=gender, emotion=emotion)`
**app.js**
`function recommendation(gender, emotion){`
`var animePlaylist = '';`
`if(emotion == 'Angry'){`
`if(gender == 'Male'){`
`animePlaylist = 'https://myanimelist.net/anime/genre/36/Slice_of_Life';`
`}`
`else if(gender == 'Female'){`
`animePlaylist = 'https://myanimelist.net/anime/genre/1/Action';`
`}`
`}`
`else if(emotion
/r/flask
https://redd.it/136wsxg
**result.html**
`<!DOCTYPE html>`
`<html lang="en">`
`<head>`
`<meta charset="UTF-8">`
`<meta http-equiv="X-UA-Compatible" content="IE=edge">`
`<meta name="viewport" content="width=device-width, initial-scale=1.0">`
`<title>Result</title>`
`</head>`
`<body>`
`<h1>Result</h1>`
`<p id ="emotion">Emotion: {{ emotion }}</p>`
`<p id ="gender">Gender: {{ gender }}</p>`
`<button onclick="recommendation('{{ gender }}', '{{ emotion }}')">Recommendation</button>`
`<div id="suggested"></div>`
`<script>`
`window.onload = function() {`
`var gender = "{{ gender }}";`
`var emotion = "{{ emotion }}";`
`recommendation(gender, emotion);`
`document.getElementById("recommendBtn").addEventListener("click", function() {`
`recommendation(gender, emotion);`
`});`
`}`
`</script>`
`</body>`
`</html>`
[**app.py**](https://app.py)
`@app.route('/resultpage')`
`def resultpage():`
`gender = request.args.get('gender')`
`emotion = request.args.get('emotion')`
`return render_template('result.html', gender=gender, emotion=emotion)`
**app.js**
`function recommendation(gender, emotion){`
`var animePlaylist = '';`
`if(emotion == 'Angry'){`
`if(gender == 'Male'){`
`animePlaylist = 'https://myanimelist.net/anime/genre/36/Slice_of_Life';`
`}`
`else if(gender == 'Female'){`
`animePlaylist = 'https://myanimelist.net/anime/genre/1/Action';`
`}`
`}`
`else if(emotion
/r/flask
https://redd.it/136wsxg
MyAnimeList.net
Slice of Life - Anime - MyAnimeList.net
Trying to find Slice of Life anime? Discover more Slice of Life anime on MyAnimeList, the largest online anime and manga database in the world!
Textual 0.23.0 improves message handling
https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/
/r/Python
https://redd.it/136jf50
https://textual.textualize.io/blog/2023/05/03/textual-0230-improves-message-handling/
/r/Python
https://redd.it/136jf50
Textual Documentation
Textual - Textual 0.23.0 improves message handling
Textual is a TUI framework for Python, inspired by modern web development.
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/1373x63
Discussion of using Python in a professional environment, getting jobs in Python as well as ask questions about courses to further your python education!
This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.
/r/Python
https://redd.it/1373x63
Reddit
r/Python on Reddit: Thursday Daily Thread: Python Careers, Courses, and Furthering Education!
Posted by u/Im__Joseph - No votes and no comments
Resources To Learn DRF
I am struggling to learn DRF i have started the course from coursera but it is not going good so can anyone suggest me some resource to learn DRF
/r/django
https://redd.it/136wth9
I am struggling to learn DRF i have started the course from coursera but it is not going good so can anyone suggest me some resource to learn DRF
/r/django
https://redd.it/136wth9
Reddit
r/django on Reddit: Resources To Learn DRF
Posted by u/Appropriate-Fox-2575 - 2 votes and 1 comment
Python-Selenium-Action: Run Selenium with Python via Github Actions using Headless or Non-Headless browsers!
https://github.com/MarketingPipeline/Python-Selenium-Action
/r/Python
https://redd.it/1376pqe
https://github.com/MarketingPipeline/Python-Selenium-Action
/r/Python
https://redd.it/1376pqe
GitHub
GitHub - MarketingPipeline/Python-Selenium-Action: Run Selenium with Python via Github Actions using Headless or Non-Headless browsers!
Run Selenium with Python via Github Actions using Headless or Non-Headless browsers! - GitHub - MarketingPipeline/Python-Selenium-Action: Run Selenium with Python via Github Actions using Headless...
Discussion: Mark Zuckerberg on Meta's Strategy on Open Source and AI during the earnings call
During the recent earnings call, Mark Zuckerberg answered a question from Eric Sheridan of Goldman Sachs on Meta's AI strategy, opportunities to integrate into products, and why they open source models and how it would benefit their business.
I found the reasoning to be very sound and promising for the OSS and AI community.
The biggest risk from AI, in my opinion, is not the doomsday scenarios that intuitively come to mind but rather that the most powerful AI systems will only be accessible to the most powerful and resourceful corporations.
Quote copied from Ben Thompson's write up on Meta's earning in his Stratechery blog post which goes beyond AI. It's behind a paywall but I highly recommend it personally.
Some noteworthy quotes that signal the thought process at Meta FAIR and more broadly
We’re just playing a different game on the infrastructure than companies like Google or Microsoft or Amazon
We would aspire to and hope to make even more open than that. So, we’ll need to figure out a way to do that.
...lead us to do more work in terms of open sourcing, some of the lower level models and tools
Open
/r/MachineLearning
https://redd.it/1373nhq
During the recent earnings call, Mark Zuckerberg answered a question from Eric Sheridan of Goldman Sachs on Meta's AI strategy, opportunities to integrate into products, and why they open source models and how it would benefit their business.
I found the reasoning to be very sound and promising for the OSS and AI community.
The biggest risk from AI, in my opinion, is not the doomsday scenarios that intuitively come to mind but rather that the most powerful AI systems will only be accessible to the most powerful and resourceful corporations.
Quote copied from Ben Thompson's write up on Meta's earning in his Stratechery blog post which goes beyond AI. It's behind a paywall but I highly recommend it personally.
Some noteworthy quotes that signal the thought process at Meta FAIR and more broadly
We’re just playing a different game on the infrastructure than companies like Google or Microsoft or Amazon
We would aspire to and hope to make even more open than that. So, we’ll need to figure out a way to do that.
...lead us to do more work in terms of open sourcing, some of the lower level models and tools
Open
/r/MachineLearning
https://redd.it/1373nhq
Stratechery
Facebook Earnings, Generative AI and Messaging Monetization, Open Source and AI
Meta’s earnings showed that all of Meta’s Myths were, in fact, myths. Plus, how LLMs can benefit Meta ad products, and why Meta might open source more AI models.
D Oblivus Cloud | Scalable GPU servers from $0.29/hr
Greetings r/MachineLearning!
This is Doruk from Oblivus, and I'm excited to announce the launch of our platform, Oblivus Cloud. After more than a year of beta testing, we're excited to offer you a platform where you can deploy affordable and scalable GPU virtual machines in as little as 30 seconds! We believe that Oblivus Cloud is the perfect alternative to other cloud service providers when it comes to training your ML models.
https://oblivus.com/cloud
🤔 What sets Oblivus Cloud apart?
At the start of our journey, we had two primary goals in mind: to democratize High-Performance Computing and make it as straightforward as possible. We understand that maintaining GPU servers through major cloud service providers can be expensive, with hidden fees adding to the burden of running and maintaining servers.
Additionally, the cloud can sometimes be overly complex for individuals who don't have much knowledge but still require powerful computing resources.
That's why we decided to create a platform that offers affordable pricing, easy usability, and high-quality performance. Oblivus Cloud provides just that - a simple, affordable, and high-quality alternative for anyone in need of powerful computing resources.
⚪ Features
Oblivus Cloud comes packed with a wide range of features to make your experience smooth, seamless, and fully customizable. Here are some
/r/MachineLearning
https://redd.it/1370xg9
Greetings r/MachineLearning!
This is Doruk from Oblivus, and I'm excited to announce the launch of our platform, Oblivus Cloud. After more than a year of beta testing, we're excited to offer you a platform where you can deploy affordable and scalable GPU virtual machines in as little as 30 seconds! We believe that Oblivus Cloud is the perfect alternative to other cloud service providers when it comes to training your ML models.
https://oblivus.com/cloud
🤔 What sets Oblivus Cloud apart?
At the start of our journey, we had two primary goals in mind: to democratize High-Performance Computing and make it as straightforward as possible. We understand that maintaining GPU servers through major cloud service providers can be expensive, with hidden fees adding to the burden of running and maintaining servers.
Additionally, the cloud can sometimes be overly complex for individuals who don't have much knowledge but still require powerful computing resources.
That's why we decided to create a platform that offers affordable pricing, easy usability, and high-quality performance. Oblivus Cloud provides just that - a simple, affordable, and high-quality alternative for anyone in need of powerful computing resources.
⚪ Features
Oblivus Cloud comes packed with a wide range of features to make your experience smooth, seamless, and fully customizable. Here are some
/r/MachineLearning
https://redd.it/1370xg9
Oblivus
Oblivus | Compute
Explore top-tier NVIDIA GPUs with Oblivus, offering unparalleled configurability and availability. Tailored specifically for handling large-scale GPU-accelerated workloads!
Build a full stack social network - Django/DRF/Vue3/Tailwind - Free YouTube Series
Hey guys,
a few weeks ago I started publishing my newest course on my YouTube channel.
In this course, you will learn how to build a social network from scratch using Django with Django Rest Framework for the backend, and the frontend will be built using Vue and Tailwind.
Some of the features of the social network:
\-Authentication with jwt
\-Posts with attachments (showing on your feed, your profile and similar).
\-Direct messaging
\-Friends (sending/accepting friend requests)
\-Liking/discussing posts
So far, I have posted 4 parts with a total of almost 4 hours of content. And much more are coming :-D
I hope this sounds interesting and that it can help some of you.
If you're interested, you can find the playlist here:
https://www.youtube.com/playlist?list=PLpyspNLjzwBlobEvnZzyWP8I-ORQcq4IO
PS, I would love it if you subscribed to my channel if you want more content like this :-D
/r/djangolearning
https://redd.it/137c38x
Hey guys,
a few weeks ago I started publishing my newest course on my YouTube channel.
In this course, you will learn how to build a social network from scratch using Django with Django Rest Framework for the backend, and the frontend will be built using Vue and Tailwind.
Some of the features of the social network:
\-Authentication with jwt
\-Posts with attachments (showing on your feed, your profile and similar).
\-Direct messaging
\-Friends (sending/accepting friend requests)
\-Liking/discussing posts
So far, I have posted 4 parts with a total of almost 4 hours of content. And much more are coming :-D
I hope this sounds interesting and that it can help some of you.
If you're interested, you can find the playlist here:
https://www.youtube.com/playlist?list=PLpyspNLjzwBlobEvnZzyWP8I-ORQcq4IO
PS, I would love it if you subscribed to my channel if you want more content like this :-D
/r/djangolearning
https://redd.it/137c38x
Reddit
From the djangolearning community on Reddit: Build a full stack social network - Django/DRF/Vue3/Tailwind - Free YouTube Series
Explore this post and more from the djangolearning community
ML model RAM over usage issue
Hi everyone, I am having an issue of RAM over usage with my ML model. My model is based on Tfidf+Kmeans algo, and uses flask + gunicorn architecture.
I have multiple gunicorn workers running on my server to handle parallel requests. The issue is that the model is not being shared b/w workers. Instead, it makes a copy of itself for each worker.
Since the model is quite big in size, this is consuming a lot of RAM. How do I solve this issue such that the model is shared between workers without being replicated?
/r/flask
https://redd.it/137ec9y
Hi everyone, I am having an issue of RAM over usage with my ML model. My model is based on Tfidf+Kmeans algo, and uses flask + gunicorn architecture.
I have multiple gunicorn workers running on my server to handle parallel requests. The issue is that the model is not being shared b/w workers. Instead, it makes a copy of itself for each worker.
Since the model is quite big in size, this is consuming a lot of RAM. How do I solve this issue such that the model is shared between workers without being replicated?
/r/flask
https://redd.it/137ec9y
Reddit
r/flask on Reddit: ML model RAM over usage issue
Posted by u/Devinco001 - 1 vote and 2 comments
Are there any working examples I can download?
I know there are a number of tutorials but I was wondering if there are any working examples I can download of say, a basic bootstrap form.
Thanks
/r/flask
https://redd.it/137ko94
I know there are a number of tutorials but I was wondering if there are any working examples I can download of say, a basic bootstrap form.
Thanks
/r/flask
https://redd.it/137ko94
Reddit
r/flask on Reddit: Are there any working examples I can download?
Posted by u/MindTheStepSoupy - No votes and no comments
(Failed - but working 100%) Interview challenge
Recently I did not even make it to the interview due to the technical team not approving of my one-way directory sync solution.
I want to mention that I did it as requested and yet I did not even get a feedback over the rejection reason.
Can someone more experienced take a glance and let me know where \\ what I did wrong? pyAppz/dirSync.py at main · Eleuthar/pyAppz (github.com)
Thank you in advance!
​
LE: I much appreciate everyone's feedback and I will try to modify the code as per your advice and will revert asap with a new review, to ensure I understood your input.
/r/Python
https://redd.it/137gvt9
Recently I did not even make it to the interview due to the technical team not approving of my one-way directory sync solution.
I want to mention that I did it as requested and yet I did not even get a feedback over the rejection reason.
Can someone more experienced take a glance and let me know where \\ what I did wrong? pyAppz/dirSync.py at main · Eleuthar/pyAppz (github.com)
Thank you in advance!
​
LE: I much appreciate everyone's feedback and I will try to modify the code as per your advice and will revert asap with a new review, to ensure I understood your input.
/r/Python
https://redd.it/137gvt9
GitHub
pyAppz/dirSync.py at main · Eleuthar/pyAppz
Contribute to Eleuthar/pyAppz development by creating an account on GitHub.
Creating 2fa with pyotp
I have a flask app that I'm trying to add a 2fa option to. I'm using pyotp to generate a code that will be sent via email.
The user signs in normally (email, password) and and if they've opted-in to 2fa they are then redirected to a page asking them to submit the security code they received in an email.
The challenge I'm facing is figuring out how I can carry the user object info to the 2fa route so that if they enter the correct code I can login\_user(user)
If they enter the correct email and password but the wrong code I need to retain the fact that they entered the email and password correctly on their following attempts.
There's a login route, and a 2fa code route.
Currently I have the 2fa code generated when the user lands on the 2fa route, there's a function called otp() that creates the one time password:
```
@app.route("/twofactor", methods=\['GET', 'POST'\])
def twofactor():
if current\_user.is\_authenticated:
return redirect(url\_for('login'))
else:
x = otp()
form=TwoFactor()
if form.validate\_on\_submit():
/r/flask
https://redd.it/137lqpb
I have a flask app that I'm trying to add a 2fa option to. I'm using pyotp to generate a code that will be sent via email.
The user signs in normally (email, password) and and if they've opted-in to 2fa they are then redirected to a page asking them to submit the security code they received in an email.
The challenge I'm facing is figuring out how I can carry the user object info to the 2fa route so that if they enter the correct code I can login\_user(user)
If they enter the correct email and password but the wrong code I need to retain the fact that they entered the email and password correctly on their following attempts.
There's a login route, and a 2fa code route.
Currently I have the 2fa code generated when the user lands on the 2fa route, there's a function called otp() that creates the one time password:
```
@app.route("/twofactor", methods=\['GET', 'POST'\])
def twofactor():
if current\_user.is\_authenticated:
return redirect(url\_for('login'))
else:
x = otp()
form=TwoFactor()
if form.validate\_on\_submit():
/r/flask
https://redd.it/137lqpb
Reddit
r/flask on Reddit: Creating 2fa with pyotp
Posted by u/Karlesimo - 1 vote and 2 comments